Update type hints across the codebase (#1749)

* Update type hints across the codebase

* Added changelog record
This commit is contained in:
Alex Root Junior 2026-01-02 02:50:46 +02:00 committed by GitHub
parent dcff0f99c7
commit 0306695b61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
307 changed files with 6190 additions and 6385 deletions

1
CHANGES/1749.misc.rst Normal file
View file

@ -0,0 +1 @@
Updated type hints in the codebase to Python 3.10+ style unions and optionals.

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,6 @@
from typing import TYPE_CHECKING, Any, Optional from __future__ import annotations
from typing import TYPE_CHECKING, Any
from pydantic import BaseModel, PrivateAttr from pydantic import BaseModel, PrivateAttr
from typing_extensions import Self from typing_extensions import Self
@ -8,12 +10,12 @@ if TYPE_CHECKING:
class BotContextController(BaseModel): class BotContextController(BaseModel):
_bot: Optional["Bot"] = PrivateAttr() _bot: Bot | None = PrivateAttr()
def model_post_init(self, __context: Any) -> None: # noqa: PYI063 def model_post_init(self, __context: Any) -> None: # noqa: PYI063
self._bot = __context.get("bot") if __context else None self._bot = __context.get("bot") if __context else None
def as_(self, bot: Optional["Bot"]) -> Self: def as_(self, bot: Bot | None) -> Self:
""" """
Bind object to a bot instance. Bind object to a bot instance.
@ -24,7 +26,7 @@ class BotContextController(BaseModel):
return self return self
@property @property
def bot(self) -> Optional["Bot"]: def bot(self) -> Bot | None:
""" """
Get bot instance. Get bot instance.

View file

@ -1,6 +1,8 @@
from __future__ import annotations
from collections.abc import Callable from collections.abc import Callable
from dataclasses import dataclass from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Union, cast, overload from typing import TYPE_CHECKING, Any, cast, overload
from magic_filter import AttrDict, MagicFilter from magic_filter import AttrDict, MagicFilter
@ -42,7 +44,7 @@ class FlagDecorator:
self, self,
value: Any | None = None, value: Any | None = None,
**kwargs: Any, **kwargs: Any,
) -> Union[Callable[..., Any], "FlagDecorator"]: ) -> Callable[..., Any] | FlagDecorator:
if value and kwargs: if value and kwargs:
msg = "The arguments `value` and **kwargs can not be used together" msg = "The arguments `value` and **kwargs can not be used together"
raise ValueError(msg) raise ValueError(msg)
@ -86,7 +88,7 @@ def extract_flags_from_object(obj: Any) -> dict[str, Any]:
return cast(dict[str, Any], obj.aiogram_flag) return cast(dict[str, Any], obj.aiogram_flag)
def extract_flags(handler: Union["HandlerObject", dict[str, Any]]) -> dict[str, Any]: def extract_flags(handler: HandlerObject | dict[str, Any]) -> dict[str, Any]:
""" """
Extract flags from handler or middleware context data Extract flags from handler or middleware context data
@ -101,7 +103,7 @@ def extract_flags(handler: Union["HandlerObject", dict[str, Any]]) -> dict[str,
def get_flag( def get_flag(
handler: Union["HandlerObject", dict[str, Any]], handler: HandlerObject | dict[str, Any],
name: str, name: str,
*, *,
default: Any | None = None, default: Any | None = None,
@ -118,7 +120,7 @@ def get_flag(
return flags.get(name, default) return flags.get(name, default)
def check_flags(handler: Union["HandlerObject", dict[str, Any]], magic: MagicFilter) -> Any: def check_flags(handler: HandlerObject | dict[str, Any], magic: MagicFilter) -> Any:
""" """
Check flags via magic filter Check flags via magic filter

View file

@ -1,4 +1,4 @@
from typing import Any, Optional from typing import Any
from aiogram.methods import TelegramMethod from aiogram.methods import TelegramMethod
from aiogram.methods.base import TelegramType from aiogram.methods.base import TelegramType

View file

@ -27,7 +27,7 @@ class Filter(ABC): # noqa: B024
Accepts incoming event and should return boolean or dict. Accepts incoming event and should return boolean or dict.
:return: :class:`bool` or :class:`Dict[str, Any]` :return: :class:`bool` or :class:`dict[str, Any]`
""" """
def __invert__(self) -> "_InvertFilter": def __invert__(self) -> "_InvertFilter":

View file

@ -1,4 +1,6 @@
from typing import Any, TypeVar, Union from __future__ import annotations
from typing import Any, TypeVar
from typing_extensions import Self from typing_extensions import Self
@ -34,7 +36,7 @@ class _MemberStatusMarker:
def __or__( def __or__(
self, self,
other: Union["_MemberStatusMarker", "_MemberStatusGroupMarker"], other: _MemberStatusMarker | _MemberStatusGroupMarker,
) -> "_MemberStatusGroupMarker": ) -> "_MemberStatusGroupMarker":
if isinstance(other, _MemberStatusMarker): if isinstance(other, _MemberStatusMarker):
return _MemberStatusGroupMarker(self, other) return _MemberStatusGroupMarker(self, other)
@ -50,7 +52,7 @@ class _MemberStatusMarker:
def __rshift__( def __rshift__(
self, self,
other: Union["_MemberStatusMarker", "_MemberStatusGroupMarker"], other: _MemberStatusMarker | _MemberStatusGroupMarker,
) -> "_MemberStatusTransition": ) -> "_MemberStatusTransition":
old = _MemberStatusGroupMarker(self) old = _MemberStatusGroupMarker(self)
if isinstance(other, _MemberStatusMarker): if isinstance(other, _MemberStatusMarker):
@ -65,7 +67,7 @@ class _MemberStatusMarker:
def __lshift__( def __lshift__(
self, self,
other: Union["_MemberStatusMarker", "_MemberStatusGroupMarker"], other: _MemberStatusMarker | _MemberStatusGroupMarker,
) -> "_MemberStatusTransition": ) -> "_MemberStatusTransition":
new = _MemberStatusGroupMarker(self) new = _MemberStatusGroupMarker(self)
if isinstance(other, _MemberStatusMarker): if isinstance(other, _MemberStatusMarker):
@ -101,7 +103,7 @@ class _MemberStatusGroupMarker:
def __or__( def __or__(
self, self,
other: Union["_MemberStatusMarker", "_MemberStatusGroupMarker"], other: _MemberStatusMarker | _MemberStatusGroupMarker,
) -> Self: ) -> Self:
if isinstance(other, _MemberStatusMarker): if isinstance(other, _MemberStatusMarker):
return type(self)(*self.statuses, other) return type(self)(*self.statuses, other)
@ -115,7 +117,7 @@ class _MemberStatusGroupMarker:
def __rshift__( def __rshift__(
self, self,
other: Union["_MemberStatusMarker", "_MemberStatusGroupMarker"], other: _MemberStatusMarker | _MemberStatusGroupMarker,
) -> "_MemberStatusTransition": ) -> "_MemberStatusTransition":
if isinstance(other, _MemberStatusMarker): if isinstance(other, _MemberStatusMarker):
return _MemberStatusTransition(old=self, new=_MemberStatusGroupMarker(other)) return _MemberStatusTransition(old=self, new=_MemberStatusGroupMarker(other))
@ -129,7 +131,7 @@ class _MemberStatusGroupMarker:
def __lshift__( def __lshift__(
self, self,
other: Union["_MemberStatusMarker", "_MemberStatusGroupMarker"], other: _MemberStatusMarker | _MemberStatusGroupMarker,
) -> "_MemberStatusTransition": ) -> "_MemberStatusTransition":
if isinstance(other, _MemberStatusMarker): if isinstance(other, _MemberStatusMarker):
return _MemberStatusTransition(old=_MemberStatusGroupMarker(other), new=self) return _MemberStatusTransition(old=_MemberStatusGroupMarker(other), new=self)

View file

@ -65,8 +65,7 @@ class Command(Filter):
if not isinstance(commands, Iterable): if not isinstance(commands, Iterable):
msg = ( msg = (
"Command filter only supports str, re.Pattern, BotCommand object" "Command filter only supports str, re.Pattern, BotCommand object or their Iterable"
" or their Iterable"
) )
raise ValueError(msg) raise ValueError(msg)

View file

@ -1,5 +1,4 @@
from abc import ABC from abc import ABC
from typing import Optional
from aiogram.handlers import BaseHandler from aiogram.handlers import BaseHandler
from aiogram.types import CallbackQuery, MaybeInaccessibleMessage, User from aiogram.types import CallbackQuery, MaybeInaccessibleMessage, User

View file

@ -1,5 +1,5 @@
from abc import ABC from abc import ABC
from typing import Optional, cast from typing import cast
from aiogram.filters import CommandObject from aiogram.filters import CommandObject
from aiogram.handlers.base import BaseHandler, BaseHandlerMixin from aiogram.handlers.base import BaseHandler, BaseHandlerMixin

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from .base import TelegramMethod from .base import TelegramMethod
@ -19,13 +19,13 @@ class AnswerCallbackQuery(TelegramMethod[bool]):
callback_query_id: str callback_query_id: str
"""Unique identifier for the query to be answered""" """Unique identifier for the query to be answered"""
text: Optional[str] = None text: str | None = None
"""Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters""" """Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters"""
show_alert: Optional[bool] = None show_alert: bool | None = None
"""If :code:`True`, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to *false*.""" """If :code:`True`, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to *false*."""
url: Optional[str] = None url: str | None = None
"""URL that will be opened by the user's client. If you have created a :class:`aiogram.types.game.Game` and accepted the conditions via `@BotFather <https://t.me/botfather>`_, specify the URL that opens your game - note that this will only work if the query comes from a `https://core.telegram.org/bots/api#inlinekeyboardbutton <https://core.telegram.org/bots/api#inlinekeyboardbutton>`_ *callback_game* button.""" """URL that will be opened by the user's client. If you have created a :class:`aiogram.types.game.Game` and accepted the conditions via `@BotFather <https://t.me/botfather>`_, specify the URL that opens your game - note that this will only work if the query comes from a `https://core.telegram.org/bots/api#inlinekeyboardbutton <https://core.telegram.org/bots/api#inlinekeyboardbutton>`_ *callback_game* button."""
cache_time: Optional[int] = None cache_time: int | None = None
"""The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0.""" """The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -36,10 +36,10 @@ class AnswerCallbackQuery(TelegramMethod[bool]):
__pydantic__self__, __pydantic__self__,
*, *,
callback_query_id: str, callback_query_id: str,
text: Optional[str] = None, text: str | None = None,
show_alert: Optional[bool] = None, show_alert: bool | None = None,
url: Optional[str] = None, url: str | None = None,
cache_time: Optional[int] = None, cache_time: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -24,20 +24,20 @@ class AnswerInlineQuery(TelegramMethod[bool]):
"""Unique identifier for the answered query""" """Unique identifier for the answered query"""
results: list[InlineQueryResultUnion] results: list[InlineQueryResultUnion]
"""A JSON-serialized array of results for the inline query""" """A JSON-serialized array of results for the inline query"""
cache_time: Optional[int] = None cache_time: int | None = None
"""The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.""" """The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300."""
is_personal: Optional[bool] = None is_personal: bool | None = None
"""Pass :code:`True` if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query.""" """Pass :code:`True` if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query."""
next_offset: Optional[str] = None next_offset: str | None = None
"""Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes.""" """Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes."""
button: Optional[InlineQueryResultsButton] = None button: InlineQueryResultsButton | None = None
"""A JSON-serialized object describing a button to be shown above inline query results""" """A JSON-serialized object describing a button to be shown above inline query results"""
switch_pm_parameter: Optional[str] = Field(None, json_schema_extra={"deprecated": True}) switch_pm_parameter: str | None = Field(None, json_schema_extra={"deprecated": True})
"""`Deep-linking <https://core.telegram.org/bots/features#deep-linking>`_ parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed. """`Deep-linking <https://core.telegram.org/bots/features#deep-linking>`_ parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only :code:`A-Z`, :code:`a-z`, :code:`0-9`, :code:`_` and :code:`-` are allowed.
.. deprecated:: API:6.7 .. deprecated:: API:6.7
https://core.telegram.org/bots/api-changelog#april-21-2023""" https://core.telegram.org/bots/api-changelog#april-21-2023"""
switch_pm_text: Optional[str] = Field(None, json_schema_extra={"deprecated": True}) switch_pm_text: str | None = Field(None, json_schema_extra={"deprecated": True})
"""If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter* """If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter *switch_pm_parameter*
.. deprecated:: API:6.7 .. deprecated:: API:6.7
@ -52,12 +52,12 @@ class AnswerInlineQuery(TelegramMethod[bool]):
*, *,
inline_query_id: str, inline_query_id: str,
results: list[InlineQueryResultUnion], results: list[InlineQueryResultUnion],
cache_time: Optional[int] = None, cache_time: int | None = None,
is_personal: Optional[bool] = None, is_personal: bool | None = None,
next_offset: Optional[str] = None, next_offset: str | None = None,
button: Optional[InlineQueryResultsButton] = None, button: InlineQueryResultsButton | None = None,
switch_pm_parameter: Optional[str] = None, switch_pm_parameter: str | None = None,
switch_pm_text: Optional[str] = None, switch_pm_text: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from .base import TelegramMethod from .base import TelegramMethod
@ -19,7 +19,7 @@ class AnswerPreCheckoutQuery(TelegramMethod[bool]):
"""Unique identifier for the query to be answered""" """Unique identifier for the query to be answered"""
ok: bool ok: bool
"""Specify :code:`True` if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use :code:`False` if there are any problems.""" """Specify :code:`True` if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use :code:`False` if there are any problems."""
error_message: Optional[str] = None error_message: str | None = None
"""Required if *ok* is :code:`False`. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user.""" """Required if *ok* is :code:`False`. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -31,7 +31,7 @@ class AnswerPreCheckoutQuery(TelegramMethod[bool]):
*, *,
pre_checkout_query_id: str, pre_checkout_query_id: str,
ok: bool, ok: bool,
error_message: Optional[str] = None, error_message: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ShippingOption from ..types import ShippingOption
from .base import TelegramMethod from .base import TelegramMethod
@ -20,9 +20,9 @@ class AnswerShippingQuery(TelegramMethod[bool]):
"""Unique identifier for the query to be answered""" """Unique identifier for the query to be answered"""
ok: bool ok: bool
"""Pass :code:`True` if delivery to the specified address is possible and :code:`False` if there are any problems (for example, if delivery to the specified address is not possible)""" """Pass :code:`True` if delivery to the specified address is possible and :code:`False` if there are any problems (for example, if delivery to the specified address is not possible)"""
shipping_options: Optional[list[ShippingOption]] = None shipping_options: list[ShippingOption] | None = None
"""Required if *ok* is :code:`True`. A JSON-serialized array of available shipping options.""" """Required if *ok* is :code:`True`. A JSON-serialized array of available shipping options."""
error_message: Optional[str] = None error_message: str | None = None
"""Required if *ok* is :code:`False`. Error message in human readable form that explains why it is impossible to complete the order (e.g. 'Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user.""" """Required if *ok* is :code:`False`. Error message in human readable form that explains why it is impossible to complete the order (e.g. 'Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -34,8 +34,8 @@ class AnswerShippingQuery(TelegramMethod[bool]):
*, *,
shipping_query_id: str, shipping_query_id: str,
ok: bool, ok: bool,
shipping_options: Optional[list[ShippingOption]] = None, shipping_options: list[ShippingOption] | None = None,
error_message: Optional[str] = None, error_message: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import DateTimeUnion from ..types import DateTimeUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -20,7 +20,7 @@ class ApproveSuggestedPost(TelegramMethod[bool]):
"""Unique identifier for the target direct messages chat""" """Unique identifier for the target direct messages chat"""
message_id: int message_id: int
"""Identifier of a suggested post message to approve""" """Identifier of a suggested post message to approve"""
send_date: Optional[DateTimeUnion] = None send_date: DateTimeUnion | None = None
"""Point in time (Unix timestamp) when the post is expected to be published; omit if the date has already been specified when the suggested post was created. If specified, then the date must be not more than 2678400 seconds (30 days) in the future""" """Point in time (Unix timestamp) when the post is expected to be published; omit if the date has already been specified when the suggested post was created. If specified, then the date must be not more than 2678400 seconds (30 days) in the future"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -32,7 +32,7 @@ class ApproveSuggestedPost(TelegramMethod[bool]):
*, *,
chat_id: int, chat_id: int,
message_id: int, message_id: int,
send_date: Optional[DateTimeUnion] = None, send_date: DateTimeUnion | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, DateTimeUnion from ..types import ChatIdUnion, DateTimeUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -20,9 +20,9 @@ class BanChatMember(TelegramMethod[bool]):
"""Unique identifier for the target group or username of the target supergroup or channel (in the format :code:`@channelusername`)""" """Unique identifier for the target group or username of the target supergroup or channel (in the format :code:`@channelusername`)"""
user_id: int user_id: int
"""Unique identifier of the target user""" """Unique identifier of the target user"""
until_date: Optional[DateTimeUnion] = None until_date: DateTimeUnion | None = None
"""Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.""" """Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only."""
revoke_messages: Optional[bool] = None revoke_messages: bool | None = None
"""Pass :code:`True` to delete all messages from the chat for the user that is being removed. If :code:`False`, the user will be able to see messages in the group that were sent before the user was removed. Always :code:`True` for supergroups and channels.""" """Pass :code:`True` to delete all messages from the chat for the user that is being removed. If :code:`False`, the user will be able to see messages in the group that were sent before the user was removed. Always :code:`True` for supergroups and channels."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -34,8 +34,8 @@ class BanChatMember(TelegramMethod[bool]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
user_id: int, user_id: int,
until_date: Optional[DateTimeUnion] = None, until_date: DateTimeUnion | None = None,
revoke_messages: Optional[bool] = None, revoke_messages: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -5,10 +5,8 @@ from typing import (
TYPE_CHECKING, TYPE_CHECKING,
Any, Any,
ClassVar, ClassVar,
Dict,
Generator, Generator,
Generic, Generic,
Optional,
TypeVar, TypeVar,
) )
@ -31,16 +29,16 @@ class Request(BaseModel):
method: str method: str
data: Dict[str, Optional[Any]] data: dict[str, Any | None]
files: Optional[Dict[str, InputFile]] files: dict[str, InputFile] | None
class Response(BaseModel, Generic[TelegramType]): class Response(BaseModel, Generic[TelegramType]):
ok: bool ok: bool
result: Optional[TelegramType] = None result: TelegramType | None = None
description: Optional[str] = None description: str | None = None
error_code: Optional[int] = None error_code: int | None = None
parameters: Optional[ResponseParameters] = None parameters: ResponseParameters | None = None
class TelegramMethod(BotContextController, BaseModel, Generic[TelegramType], ABC): class TelegramMethod(BotContextController, BaseModel, Generic[TelegramType], ABC):
@ -52,7 +50,7 @@ class TelegramMethod(BotContextController, BaseModel, Generic[TelegramType], ABC
@model_validator(mode="before") @model_validator(mode="before")
@classmethod @classmethod
def remove_unset(cls, values: Dict[str, Any]) -> Dict[str, Any]: def remove_unset(cls, values: dict[str, Any]) -> dict[str, Any]:
""" """
Remove UNSET before fields validation. Remove UNSET before fields validation.

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -33,42 +33,40 @@ class CopyMessage(TelegramMethod[MessageId]):
"""Unique identifier for the chat where the original message was sent (or channel username in the format :code:`@channelusername`)""" """Unique identifier for the chat where the original message was sent (or channel username in the format :code:`@channelusername`)"""
message_id: int message_id: int
"""Message identifier in the chat specified in *from_chat_id*""" """Message identifier in the chat specified in *from_chat_id*"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
video_start_timestamp: Optional[DateTimeUnion] = None video_start_timestamp: DateTimeUnion | None = None
"""New start timestamp for the copied video in the message""" """New start timestamp for the copied video in the message"""
caption: Optional[str] = None caption: str | None = None
"""New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept""" """New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode") parse_mode: str | Default | None = Default("parse_mode")
"""Mode for parsing entities in the new caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.""" """Mode for parsing entities in the new caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[list[MessageEntity]] = None caption_entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of *parse_mode*""" """A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of *parse_mode*"""
show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") show_caption_above_media: bool | Default | None = Default("show_caption_above_media")
"""Pass :code:`True`, if the caption must be shown above the message media. Ignored if a new caption isn't specified.""" """Pass :code:`True`, if the caption must be shown above the message media. Ignored if a new caption isn't specified."""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; only available when copying to private chats""" """Unique identifier of the message effect to be added to the message; only available when copying to private chats"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None reply_markup: ReplyMarkupUnion | None = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user""" """Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -84,24 +82,22 @@ class CopyMessage(TelegramMethod[MessageId]):
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
from_chat_id: ChatIdUnion, from_chat_id: ChatIdUnion,
message_id: int, message_id: int,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
video_start_timestamp: Optional[DateTimeUnion] = None, video_start_timestamp: DateTimeUnion | None = None,
caption: Optional[str] = None, caption: str | None = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), parse_mode: str | Default | None = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None, caption_entities: list[MessageEntity] | None = None,
show_caption_above_media: Optional[Union[bool, Default]] = Default( show_caption_above_media: bool | Default | None = Default("show_caption_above_media"),
"show_caption_above_media" disable_notification: bool | None = None,
), protect_content: bool | Default | None = Default("protect_content"),
disable_notification: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), message_effect_id: str | None = None,
allow_paid_broadcast: Optional[bool] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
message_effect_id: Optional[str] = None, reply_parameters: ReplyParameters | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, reply_markup: ReplyMarkupUnion | None = None,
reply_parameters: Optional[ReplyParameters] = None, allow_sending_without_reply: bool | None = None,
reply_markup: Optional[ReplyMarkupUnion] = None, reply_to_message_id: int | None = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, MessageId from ..types import ChatIdUnion, MessageId
from .base import TelegramMethod from .base import TelegramMethod
@ -20,15 +20,15 @@ class CopyMessages(TelegramMethod[list[MessageId]]):
"""Unique identifier for the chat where the original messages were sent (or channel username in the format :code:`@channelusername`)""" """Unique identifier for the chat where the original messages were sent (or channel username in the format :code:`@channelusername`)"""
message_ids: list[int] message_ids: list[int]
"""A JSON-serialized list of 1-100 identifiers of messages in the chat *from_chat_id* to copy. The identifiers must be specified in a strictly increasing order.""" """A JSON-serialized list of 1-100 identifiers of messages in the chat *from_chat_id* to copy. The identifiers must be specified in a strictly increasing order."""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat""" """Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the messages `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the messages `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[bool] = None protect_content: bool | None = None
"""Protects the contents of the sent messages from forwarding and saving""" """Protects the contents of the sent messages from forwarding and saving"""
remove_caption: Optional[bool] = None remove_caption: bool | None = None
"""Pass :code:`True` to copy the messages without their captions""" """Pass :code:`True` to copy the messages without their captions"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -41,11 +41,11 @@ class CopyMessages(TelegramMethod[list[MessageId]]):
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
from_chat_id: ChatIdUnion, from_chat_id: ChatIdUnion,
message_ids: list[int], message_ids: list[int],
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[bool] = None, protect_content: bool | None = None,
remove_caption: Optional[bool] = None, remove_caption: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, ChatInviteLink, DateTimeUnion from ..types import ChatIdUnion, ChatInviteLink, DateTimeUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -18,13 +18,13 @@ class CreateChatInviteLink(TelegramMethod[ChatInviteLink]):
chat_id: ChatIdUnion chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
name: Optional[str] = None name: str | None = None
"""Invite link name; 0-32 characters""" """Invite link name; 0-32 characters"""
expire_date: Optional[DateTimeUnion] = None expire_date: DateTimeUnion | None = None
"""Point in time (Unix timestamp) when the link will expire""" """Point in time (Unix timestamp) when the link will expire"""
member_limit: Optional[int] = None member_limit: int | None = None
"""The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999""" """The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"""
creates_join_request: Optional[bool] = None creates_join_request: bool | None = None
""":code:`True`, if users joining the chat via the link need to be approved by chat administrators. If :code:`True`, *member_limit* can't be specified""" """:code:`True`, if users joining the chat via the link need to be approved by chat administrators. If :code:`True`, *member_limit* can't be specified"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -35,10 +35,10 @@ class CreateChatInviteLink(TelegramMethod[ChatInviteLink]):
__pydantic__self__, __pydantic__self__,
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
name: Optional[str] = None, name: str | None = None,
expire_date: Optional[DateTimeUnion] = None, expire_date: DateTimeUnion | None = None,
member_limit: Optional[int] = None, member_limit: int | None = None,
creates_join_request: Optional[bool] = None, creates_join_request: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, ChatInviteLink, DateTimeUnion from ..types import ChatIdUnion, ChatInviteLink, DateTimeUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -22,7 +22,7 @@ class CreateChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]):
"""The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).""" """The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days)."""
subscription_price: int subscription_price: int
"""The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000""" """The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000"""
name: Optional[str] = None name: str | None = None
"""Invite link name; 0-32 characters""" """Invite link name; 0-32 characters"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -35,7 +35,7 @@ class CreateChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]):
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
subscription_period: DateTimeUnion, subscription_period: DateTimeUnion,
subscription_price: int, subscription_price: int,
name: Optional[str] = None, name: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, ForumTopic from ..types import ChatIdUnion, ForumTopic
from .base import TelegramMethod from .base import TelegramMethod
@ -20,9 +20,9 @@ class CreateForumTopic(TelegramMethod[ForumTopic]):
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)""" """Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
name: str name: str
"""Topic name, 1-128 characters""" """Topic name, 1-128 characters"""
icon_color: Optional[int] = None icon_color: int | None = None
"""Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F)""" """Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F)"""
icon_custom_emoji_id: Optional[str] = None icon_custom_emoji_id: str | None = None
"""Unique identifier of the custom emoji shown as the topic icon. Use :class:`aiogram.methods.get_forum_topic_icon_stickers.GetForumTopicIconStickers` to get all allowed custom emoji identifiers.""" """Unique identifier of the custom emoji shown as the topic icon. Use :class:`aiogram.methods.get_forum_topic_icon_stickers.GetForumTopicIconStickers` to get all allowed custom emoji identifiers."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -34,8 +34,8 @@ class CreateForumTopic(TelegramMethod[ForumTopic]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
name: str, name: str,
icon_color: Optional[int] = None, icon_color: int | None = None,
icon_custom_emoji_id: Optional[str] = None, icon_custom_emoji_id: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import LabeledPrice from ..types import LabeledPrice
from .base import TelegramMethod from .base import TelegramMethod
@ -26,39 +26,39 @@ class CreateInvoiceLink(TelegramMethod[str]):
"""Three-letter ISO 4217 currency code, see `more on currencies <https://core.telegram.org/bots/payments#supported-currencies>`_. Pass 'XTR' for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Three-letter ISO 4217 currency code, see `more on currencies <https://core.telegram.org/bots/payments#supported-currencies>`_. Pass 'XTR' for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
prices: list[LabeledPrice] prices: list[LabeledPrice]
"""Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the link will be created. For payments in `Telegram Stars <https://t.me/BotNews/90>`_ only.""" """Unique identifier of the business connection on behalf of which the link will be created. For payments in `Telegram Stars <https://t.me/BotNews/90>`_ only."""
provider_token: Optional[str] = None provider_token: str | None = None
"""Payment provider token, obtained via `@BotFather <https://t.me/botfather>`_. Pass an empty string for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Payment provider token, obtained via `@BotFather <https://t.me/botfather>`_. Pass an empty string for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
subscription_period: Optional[int] = None subscription_period: int | None = None
"""The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 10000 Telegram Stars.""" """The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 10000 Telegram Stars."""
max_tip_amount: Optional[int] = None max_tip_amount: int | None = None
"""The maximum accepted amount for tips in the *smallest units* of the currency (integer, **not** float/double). For example, for a maximum tip of :code:`US$ 1.45` pass :code:`max_tip_amount = 145`. See the *exp* parameter in `currencies.json <https://core.telegram.org/bots/payments/currencies.json>`_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """The maximum accepted amount for tips in the *smallest units* of the currency (integer, **not** float/double). For example, for a maximum tip of :code:`US$ 1.45` pass :code:`max_tip_amount = 145`. See the *exp* parameter in `currencies.json <https://core.telegram.org/bots/payments/currencies.json>`_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
suggested_tip_amounts: Optional[list[int]] = None suggested_tip_amounts: list[int] | None = None
"""A JSON-serialized array of suggested amounts of tips in the *smallest units* of the currency (integer, **not** float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed *max_tip_amount*.""" """A JSON-serialized array of suggested amounts of tips in the *smallest units* of the currency (integer, **not** float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed *max_tip_amount*."""
provider_data: Optional[str] = None provider_data: str | None = None
"""JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.""" """JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider."""
photo_url: Optional[str] = None photo_url: str | None = None
"""URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service.""" """URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service."""
photo_size: Optional[int] = None photo_size: int | None = None
"""Photo size in bytes""" """Photo size in bytes"""
photo_width: Optional[int] = None photo_width: int | None = None
"""Photo width""" """Photo width"""
photo_height: Optional[int] = None photo_height: int | None = None
"""Photo height""" """Photo height"""
need_name: Optional[bool] = None need_name: bool | None = None
"""Pass :code:`True` if you require the user's full name to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Pass :code:`True` if you require the user's full name to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
need_phone_number: Optional[bool] = None need_phone_number: bool | None = None
"""Pass :code:`True` if you require the user's phone number to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Pass :code:`True` if you require the user's phone number to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
need_email: Optional[bool] = None need_email: bool | None = None
"""Pass :code:`True` if you require the user's email address to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Pass :code:`True` if you require the user's email address to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
need_shipping_address: Optional[bool] = None need_shipping_address: bool | None = None
"""Pass :code:`True` if you require the user's shipping address to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Pass :code:`True` if you require the user's shipping address to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
send_phone_number_to_provider: Optional[bool] = None send_phone_number_to_provider: bool | None = None
"""Pass :code:`True` if the user's phone number should be sent to the provider. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Pass :code:`True` if the user's phone number should be sent to the provider. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
send_email_to_provider: Optional[bool] = None send_email_to_provider: bool | None = None
"""Pass :code:`True` if the user's email address should be sent to the provider. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Pass :code:`True` if the user's email address should be sent to the provider. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
is_flexible: Optional[bool] = None is_flexible: bool | None = None
"""Pass :code:`True` if the final price depends on the shipping method. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Pass :code:`True` if the final price depends on the shipping method. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -73,23 +73,23 @@ class CreateInvoiceLink(TelegramMethod[str]):
payload: str, payload: str,
currency: str, currency: str,
prices: list[LabeledPrice], prices: list[LabeledPrice],
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
provider_token: Optional[str] = None, provider_token: str | None = None,
subscription_period: Optional[int] = None, subscription_period: int | None = None,
max_tip_amount: Optional[int] = None, max_tip_amount: int | None = None,
suggested_tip_amounts: Optional[list[int]] = None, suggested_tip_amounts: list[int] | None = None,
provider_data: Optional[str] = None, provider_data: str | None = None,
photo_url: Optional[str] = None, photo_url: str | None = None,
photo_size: Optional[int] = None, photo_size: int | None = None,
photo_width: Optional[int] = None, photo_width: int | None = None,
photo_height: Optional[int] = None, photo_height: int | None = None,
need_name: Optional[bool] = None, need_name: bool | None = None,
need_phone_number: Optional[bool] = None, need_phone_number: bool | None = None,
need_email: Optional[bool] = None, need_email: bool | None = None,
need_shipping_address: Optional[bool] = None, need_shipping_address: bool | None = None,
send_phone_number_to_provider: Optional[bool] = None, send_phone_number_to_provider: bool | None = None,
send_email_to_provider: Optional[bool] = None, send_email_to_provider: bool | None = None,
is_flexible: Optional[bool] = None, is_flexible: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -26,11 +26,11 @@ class CreateNewStickerSet(TelegramMethod[bool]):
"""Sticker set title, 1-64 characters""" """Sticker set title, 1-64 characters"""
stickers: list[InputSticker] stickers: list[InputSticker]
"""A JSON-serialized list of 1-50 initial stickers to be added to the sticker set""" """A JSON-serialized list of 1-50 initial stickers to be added to the sticker set"""
sticker_type: Optional[str] = None sticker_type: str | None = None
"""Type of stickers in the set, pass 'regular', 'mask', or 'custom_emoji'. By default, a regular sticker set is created.""" """Type of stickers in the set, pass 'regular', 'mask', or 'custom_emoji'. By default, a regular sticker set is created."""
needs_repainting: Optional[bool] = None needs_repainting: bool | None = None
"""Pass :code:`True` if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only""" """Pass :code:`True` if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only"""
sticker_format: Optional[str] = Field(None, json_schema_extra={"deprecated": True}) sticker_format: str | None = Field(None, json_schema_extra={"deprecated": True})
"""Format of stickers in the set, must be one of 'static', 'animated', 'video' """Format of stickers in the set, must be one of 'static', 'animated', 'video'
.. deprecated:: API:7.2 .. deprecated:: API:7.2
@ -47,9 +47,9 @@ class CreateNewStickerSet(TelegramMethod[bool]):
name: str, name: str,
title: str, title: str,
stickers: list[InputSticker], stickers: list[InputSticker],
sticker_type: Optional[str] = None, sticker_type: str | None = None,
needs_repainting: Optional[bool] = None, needs_repainting: bool | None = None,
sticker_format: Optional[str] = None, sticker_format: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from .base import TelegramMethod from .base import TelegramMethod
@ -19,7 +19,7 @@ class DeclineSuggestedPost(TelegramMethod[bool]):
"""Unique identifier for the target direct messages chat""" """Unique identifier for the target direct messages chat"""
message_id: int message_id: int
"""Identifier of a suggested post message to decline""" """Identifier of a suggested post message to decline"""
comment: Optional[str] = None comment: str | None = None
"""Comment for the creator of the suggested post; 0-128 characters""" """Comment for the creator of the suggested post; 0-128 characters"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -31,7 +31,7 @@ class DeclineSuggestedPost(TelegramMethod[bool]):
*, *,
chat_id: int, chat_id: int,
message_id: int, message_id: int,
comment: Optional[str] = None, comment: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import BotCommandScopeUnion from ..types import BotCommandScopeUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -16,9 +16,9 @@ class DeleteMyCommands(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
__api_method__ = "deleteMyCommands" __api_method__ = "deleteMyCommands"
scope: Optional[BotCommandScopeUnion] = None scope: BotCommandScopeUnion | None = None
"""A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`.""" """A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`."""
language_code: Optional[str] = None language_code: str | None = None
"""A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands""" """A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -28,8 +28,8 @@ class DeleteMyCommands(TelegramMethod[bool]):
def __init__( def __init__(
__pydantic__self__, __pydantic__self__,
*, *,
scope: Optional[BotCommandScopeUnion] = None, scope: BotCommandScopeUnion | None = None,
language_code: Optional[str] = None, language_code: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from .base import TelegramMethod from .base import TelegramMethod
@ -15,7 +15,7 @@ class DeleteWebhook(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
__api_method__ = "deleteWebhook" __api_method__ = "deleteWebhook"
drop_pending_updates: Optional[bool] = None drop_pending_updates: bool | None = None
"""Pass :code:`True` to drop all pending updates""" """Pass :code:`True` to drop all pending updates"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -25,7 +25,7 @@ class DeleteWebhook(TelegramMethod[bool]):
def __init__( def __init__(
__pydantic__self__, __pydantic__self__,
*, *,
drop_pending_updates: Optional[bool] = None, drop_pending_updates: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, ChatInviteLink, DateTimeUnion from ..types import ChatIdUnion, ChatInviteLink, DateTimeUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -20,13 +20,13 @@ class EditChatInviteLink(TelegramMethod[ChatInviteLink]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
invite_link: str invite_link: str
"""The invite link to edit""" """The invite link to edit"""
name: Optional[str] = None name: str | None = None
"""Invite link name; 0-32 characters""" """Invite link name; 0-32 characters"""
expire_date: Optional[DateTimeUnion] = None expire_date: DateTimeUnion | None = None
"""Point in time (Unix timestamp) when the link will expire""" """Point in time (Unix timestamp) when the link will expire"""
member_limit: Optional[int] = None member_limit: int | None = None
"""The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999""" """The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"""
creates_join_request: Optional[bool] = None creates_join_request: bool | None = None
""":code:`True`, if users joining the chat via the link need to be approved by chat administrators. If :code:`True`, *member_limit* can't be specified""" """:code:`True`, if users joining the chat via the link need to be approved by chat administrators. If :code:`True`, *member_limit* can't be specified"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -38,10 +38,10 @@ class EditChatInviteLink(TelegramMethod[ChatInviteLink]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
invite_link: str, invite_link: str,
name: Optional[str] = None, name: str | None = None,
expire_date: Optional[DateTimeUnion] = None, expire_date: DateTimeUnion | None = None,
member_limit: Optional[int] = None, member_limit: int | None = None,
creates_join_request: Optional[bool] = None, creates_join_request: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, ChatInviteLink from ..types import ChatIdUnion, ChatInviteLink
from .base import TelegramMethod from .base import TelegramMethod
@ -20,7 +20,7 @@ class EditChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
invite_link: str invite_link: str
"""The invite link to edit""" """The invite link to edit"""
name: Optional[str] = None name: str | None = None
"""Invite link name; 0-32 characters""" """Invite link name; 0-32 characters"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -32,7 +32,7 @@ class EditChatSubscriptionInviteLink(TelegramMethod[ChatInviteLink]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
invite_link: str, invite_link: str,
name: Optional[str] = None, name: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion from ..types import ChatIdUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -20,9 +20,9 @@ class EditForumTopic(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)""" """Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
message_thread_id: int message_thread_id: int
"""Unique identifier for the target message thread of the forum topic""" """Unique identifier for the target message thread of the forum topic"""
name: Optional[str] = None name: str | None = None
"""New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept""" """New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept"""
icon_custom_emoji_id: Optional[str] = None icon_custom_emoji_id: str | None = None
"""New unique identifier of the custom emoji shown as the topic icon. Use :class:`aiogram.methods.get_forum_topic_icon_stickers.GetForumTopicIconStickers` to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept""" """New unique identifier of the custom emoji shown as the topic icon. Use :class:`aiogram.methods.get_forum_topic_icon_stickers.GetForumTopicIconStickers` to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -34,8 +34,8 @@ class EditForumTopic(TelegramMethod[bool]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
message_thread_id: int, message_thread_id: int,
name: Optional[str] = None, name: str | None = None,
icon_custom_emoji_id: Optional[str] = None, icon_custom_emoji_id: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,39 +1,39 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from ..client.default import Default from ..client.default import Default
from ..types import ChatIdUnion, InlineKeyboardMarkup, Message, MessageEntity from ..types import ChatIdUnion, InlineKeyboardMarkup, Message, MessageEntity
from .base import TelegramMethod from .base import TelegramMethod
class EditMessageCaption(TelegramMethod[Union[Message, bool]]): class EditMessageCaption(TelegramMethod[Message | bool]):
""" """
Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent. Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagecaption Source: https://core.telegram.org/bots/api#editmessagecaption
""" """
__returning__ = Union[Message, bool] __returning__ = Message | bool
__api_method__ = "editMessageCaption" __api_method__ = "editMessageCaption"
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent""" """Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[ChatIdUnion] = None chat_id: ChatIdUnion | None = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None message_id: int | None = None
"""Required if *inline_message_id* is not specified. Identifier of the message to edit""" """Required if *inline_message_id* is not specified. Identifier of the message to edit"""
inline_message_id: Optional[str] = None inline_message_id: str | None = None
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message""" """Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
caption: Optional[str] = None caption: str | None = None
"""New caption of the message, 0-1024 characters after entities parsing""" """New caption of the message, 0-1024 characters after entities parsing"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode") parse_mode: str | Default | None = Default("parse_mode")
"""Mode for parsing entities in the message caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.""" """Mode for parsing entities in the message caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[list[MessageEntity]] = None caption_entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") show_caption_above_media: bool | Default | None = Default("show_caption_above_media")
"""Pass :code:`True`, if the caption must be shown above the message media. Supported only for animation, photo and video messages.""" """Pass :code:`True`, if the caption must be shown above the message media. Supported only for animation, photo and video messages."""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: InlineKeyboardMarkup | None = None
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_.""" """A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -43,17 +43,15 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
def __init__( def __init__(
__pydantic__self__, __pydantic__self__,
*, *,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
chat_id: Optional[ChatIdUnion] = None, chat_id: ChatIdUnion | None = None,
message_id: Optional[int] = None, message_id: int | None = None,
inline_message_id: Optional[str] = None, inline_message_id: str | None = None,
caption: Optional[str] = None, caption: str | None = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), parse_mode: str | Default | None = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None, caption_entities: list[MessageEntity] | None = None,
show_caption_above_media: Optional[Union[bool, Default]] = Default( show_caption_above_media: bool | Default | None = Default("show_caption_above_media"),
"show_caption_above_media" reply_markup: InlineKeyboardMarkup | None = None,
),
reply_markup: Optional[InlineKeyboardMarkup] = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import InlineKeyboardMarkup, InputChecklist, Message from ..types import InlineKeyboardMarkup, InputChecklist, Message
from .base import TelegramMethod from .base import TelegramMethod
@ -24,7 +24,7 @@ class EditMessageChecklist(TelegramMethod[Message]):
"""Unique identifier for the target message""" """Unique identifier for the target message"""
checklist: InputChecklist checklist: InputChecklist
"""A JSON-serialized object for the new checklist""" """A JSON-serialized object for the new checklist"""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: InlineKeyboardMarkup | None = None
"""A JSON-serialized object for the new inline keyboard for the message""" """A JSON-serialized object for the new inline keyboard for the message"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -38,7 +38,7 @@ class EditMessageChecklist(TelegramMethod[Message]):
chat_id: int, chat_id: int,
message_id: int, message_id: int,
checklist: InputChecklist, checklist: InputChecklist,
reply_markup: Optional[InlineKeyboardMarkup] = None, reply_markup: InlineKeyboardMarkup | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,42 +1,42 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, InlineKeyboardMarkup, Message from ..types import ChatIdUnion, InlineKeyboardMarkup, Message
from .base import TelegramMethod from .base import TelegramMethod
class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]): class EditMessageLiveLocation(TelegramMethod[Message | bool]):
""" """
Use this method to edit live location messages. A location can be edited until its *live_period* expires or editing is explicitly disabled by a call to :class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation`. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Use this method to edit live location messages. A location can be edited until its *live_period* expires or editing is explicitly disabled by a call to :class:`aiogram.methods.stop_message_live_location.StopMessageLiveLocation`. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned.
Source: https://core.telegram.org/bots/api#editmessagelivelocation Source: https://core.telegram.org/bots/api#editmessagelivelocation
""" """
__returning__ = Union[Message, bool] __returning__ = Message | bool
__api_method__ = "editMessageLiveLocation" __api_method__ = "editMessageLiveLocation"
latitude: float latitude: float
"""Latitude of new location""" """Latitude of new location"""
longitude: float longitude: float
"""Longitude of new location""" """Longitude of new location"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent""" """Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[ChatIdUnion] = None chat_id: ChatIdUnion | None = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None message_id: int | None = None
"""Required if *inline_message_id* is not specified. Identifier of the message to edit""" """Required if *inline_message_id* is not specified. Identifier of the message to edit"""
inline_message_id: Optional[str] = None inline_message_id: str | None = None
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message""" """Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
live_period: Optional[int] = None live_period: int | None = None
"""New period in seconds during which the location can be updated, starting from the message send date. If 0x7FFFFFFF is specified, then the location can be updated forever. Otherwise, the new value must not exceed the current *live_period* by more than a day, and the live location expiration date must remain within the next 90 days. If not specified, then *live_period* remains unchanged""" """New period in seconds during which the location can be updated, starting from the message send date. If 0x7FFFFFFF is specified, then the location can be updated forever. Otherwise, the new value must not exceed the current *live_period* by more than a day, and the live location expiration date must remain within the next 90 days. If not specified, then *live_period* remains unchanged"""
horizontal_accuracy: Optional[float] = None horizontal_accuracy: float | None = None
"""The radius of uncertainty for the location, measured in meters; 0-1500""" """The radius of uncertainty for the location, measured in meters; 0-1500"""
heading: Optional[int] = None heading: int | None = None
"""Direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.""" """Direction in which the user is moving, in degrees. Must be between 1 and 360 if specified."""
proximity_alert_radius: Optional[int] = None proximity_alert_radius: int | None = None
"""The maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.""" """The maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified."""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: InlineKeyboardMarkup | None = None
"""A JSON-serialized object for a new `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_.""" """A JSON-serialized object for a new `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -48,15 +48,15 @@ class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
*, *,
latitude: float, latitude: float,
longitude: float, longitude: float,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
chat_id: Optional[ChatIdUnion] = None, chat_id: ChatIdUnion | None = None,
message_id: Optional[int] = None, message_id: int | None = None,
inline_message_id: Optional[str] = None, inline_message_id: str | None = None,
live_period: Optional[int] = None, live_period: int | None = None,
horizontal_accuracy: Optional[float] = None, horizontal_accuracy: float | None = None,
heading: Optional[int] = None, heading: int | None = None,
proximity_alert_radius: Optional[int] = None, proximity_alert_radius: int | None = None,
reply_markup: Optional[InlineKeyboardMarkup] = None, reply_markup: InlineKeyboardMarkup | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,32 +1,32 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, InlineKeyboardMarkup, InputMediaUnion, Message from ..types import ChatIdUnion, InlineKeyboardMarkup, InputMediaUnion, Message
from .base import TelegramMethod from .base import TelegramMethod
class EditMessageMedia(TelegramMethod[Union[Message, bool]]): class EditMessageMedia(TelegramMethod[Message | bool]):
""" """
Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent. Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagemedia Source: https://core.telegram.org/bots/api#editmessagemedia
""" """
__returning__ = Union[Message, bool] __returning__ = Message | bool
__api_method__ = "editMessageMedia" __api_method__ = "editMessageMedia"
media: InputMediaUnion media: InputMediaUnion
"""A JSON-serialized object for a new media content of the message""" """A JSON-serialized object for a new media content of the message"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent""" """Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[ChatIdUnion] = None chat_id: ChatIdUnion | None = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None message_id: int | None = None
"""Required if *inline_message_id* is not specified. Identifier of the message to edit""" """Required if *inline_message_id* is not specified. Identifier of the message to edit"""
inline_message_id: Optional[str] = None inline_message_id: str | None = None
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message""" """Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: InlineKeyboardMarkup | None = None
"""A JSON-serialized object for a new `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_.""" """A JSON-serialized object for a new `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -37,11 +37,11 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
__pydantic__self__, __pydantic__self__,
*, *,
media: InputMediaUnion, media: InputMediaUnion,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
chat_id: Optional[ChatIdUnion] = None, chat_id: ChatIdUnion | None = None,
message_id: Optional[int] = None, message_id: int | None = None,
inline_message_id: Optional[str] = None, inline_message_id: str | None = None,
reply_markup: Optional[InlineKeyboardMarkup] = None, reply_markup: InlineKeyboardMarkup | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,30 +1,30 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, InlineKeyboardMarkup, Message from ..types import ChatIdUnion, InlineKeyboardMarkup, Message
from .base import TelegramMethod from .base import TelegramMethod
class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]): class EditMessageReplyMarkup(TelegramMethod[Message | bool]):
""" """
Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent. Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagereplymarkup Source: https://core.telegram.org/bots/api#editmessagereplymarkup
""" """
__returning__ = Union[Message, bool] __returning__ = Message | bool
__api_method__ = "editMessageReplyMarkup" __api_method__ = "editMessageReplyMarkup"
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent""" """Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[ChatIdUnion] = None chat_id: ChatIdUnion | None = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None message_id: int | None = None
"""Required if *inline_message_id* is not specified. Identifier of the message to edit""" """Required if *inline_message_id* is not specified. Identifier of the message to edit"""
inline_message_id: Optional[str] = None inline_message_id: str | None = None
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message""" """Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: InlineKeyboardMarkup | None = None
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_.""" """A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -34,11 +34,11 @@ class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]):
def __init__( def __init__(
__pydantic__self__, __pydantic__self__,
*, *,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
chat_id: Optional[ChatIdUnion] = None, chat_id: ChatIdUnion | None = None,
message_id: Optional[int] = None, message_id: int | None = None,
inline_message_id: Optional[str] = None, inline_message_id: str | None = None,
reply_markup: Optional[InlineKeyboardMarkup] = None, reply_markup: InlineKeyboardMarkup | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -15,35 +15,35 @@ from ..types import (
from .base import TelegramMethod from .base import TelegramMethod
class EditMessageText(TelegramMethod[Union[Message, bool]]): class EditMessageText(TelegramMethod[Message | bool]):
""" """
Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent. Use this method to edit text and `game <https://core.telegram.org/bots/api#games>`_ messages. On success, if the edited message is not an inline message, the edited :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within **48 hours** from the time they were sent.
Source: https://core.telegram.org/bots/api#editmessagetext Source: https://core.telegram.org/bots/api#editmessagetext
""" """
__returning__ = Union[Message, bool] __returning__ = Message | bool
__api_method__ = "editMessageText" __api_method__ = "editMessageText"
text: str text: str
"""New text of the message, 1-4096 characters after entities parsing""" """New text of the message, 1-4096 characters after entities parsing"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message to be edited was sent""" """Unique identifier of the business connection on behalf of which the message to be edited was sent"""
chat_id: Optional[ChatIdUnion] = None chat_id: ChatIdUnion | None = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Required if *inline_message_id* is not specified. Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: Optional[int] = None message_id: int | None = None
"""Required if *inline_message_id* is not specified. Identifier of the message to edit""" """Required if *inline_message_id* is not specified. Identifier of the message to edit"""
inline_message_id: Optional[str] = None inline_message_id: str | None = None
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message""" """Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode") parse_mode: str | Default | None = Default("parse_mode")
"""Mode for parsing entities in the message text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.""" """Mode for parsing entities in the message text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
entities: Optional[list[MessageEntity]] = None entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*""" """A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*"""
link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default("link_preview") link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview")
"""Link preview generation options for the message""" """Link preview generation options for the message"""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: InlineKeyboardMarkup | None = None
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_.""" """A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_."""
disable_web_page_preview: Optional[Union[bool, Default]] = Field( disable_web_page_preview: bool | Default | None = Field(
Default("link_preview_is_disabled"), json_schema_extra={"deprecated": True} Default("link_preview_is_disabled"), json_schema_extra={"deprecated": True}
) )
"""Disables link previews for links in this message """Disables link previews for links in this message
@ -59,19 +59,15 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]):
__pydantic__self__, __pydantic__self__,
*, *,
text: str, text: str,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
chat_id: Optional[ChatIdUnion] = None, chat_id: ChatIdUnion | None = None,
message_id: Optional[int] = None, message_id: int | None = None,
inline_message_id: Optional[str] = None, inline_message_id: str | None = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), parse_mode: str | Default | None = Default("parse_mode"),
entities: Optional[list[MessageEntity]] = None, entities: list[MessageEntity] | None = None,
link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default( link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview"),
"link_preview" reply_markup: InlineKeyboardMarkup | None = None,
), disable_web_page_preview: bool | Default | None = Default("link_preview_is_disabled"),
reply_markup: Optional[InlineKeyboardMarkup] = None,
disable_web_page_preview: Optional[Union[bool, Default]] = Default(
"link_preview_is_disabled"
),
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import InputStoryContentUnion, MessageEntity, Story, StoryArea from ..types import InputStoryContentUnion, MessageEntity, Story, StoryArea
from .base import TelegramMethod from .base import TelegramMethod
@ -22,13 +22,13 @@ class EditStory(TelegramMethod[Story]):
"""Unique identifier of the story to edit""" """Unique identifier of the story to edit"""
content: InputStoryContentUnion content: InputStoryContentUnion
"""Content of the story""" """Content of the story"""
caption: Optional[str] = None caption: str | None = None
"""Caption of the story, 0-2048 characters after entities parsing""" """Caption of the story, 0-2048 characters after entities parsing"""
parse_mode: Optional[str] = None parse_mode: str | None = None
"""Mode for parsing entities in the story caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.""" """Mode for parsing entities in the story caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[list[MessageEntity]] = None caption_entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
areas: Optional[list[StoryArea]] = None areas: list[StoryArea] | None = None
"""A JSON-serialized list of clickable areas to be shown on the story""" """A JSON-serialized list of clickable areas to be shown on the story"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -41,10 +41,10 @@ class EditStory(TelegramMethod[Story]):
business_connection_id: str, business_connection_id: str,
story_id: int, story_id: int,
content: InputStoryContentUnion, content: InputStoryContentUnion,
caption: Optional[str] = None, caption: str | None = None,
parse_mode: Optional[str] = None, parse_mode: str | None = None,
caption_entities: Optional[list[MessageEntity]] = None, caption_entities: list[MessageEntity] | None = None,
areas: Optional[list[StoryArea]] = None, areas: list[StoryArea] | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from ..client.default import Default from ..client.default import Default
from ..types import ChatIdUnion, DateTimeUnion, Message, SuggestedPostParameters from ..types import ChatIdUnion, DateTimeUnion, Message, SuggestedPostParameters
@ -23,19 +23,19 @@ class ForwardMessage(TelegramMethod[Message]):
"""Unique identifier for the chat where the original message was sent (or channel username in the format :code:`@channelusername`)""" """Unique identifier for the chat where the original message was sent (or channel username in the format :code:`@channelusername`)"""
message_id: int message_id: int
"""Message identifier in the chat specified in *from_chat_id*""" """Message identifier in the chat specified in *from_chat_id*"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be forwarded; required if the message is forwarded to a direct messages chat""" """Identifier of the direct messages topic to which the message will be forwarded; required if the message is forwarded to a direct messages chat"""
video_start_timestamp: Optional[DateTimeUnion] = None video_start_timestamp: DateTimeUnion | None = None
"""New start timestamp for the forwarded video in the message""" """New start timestamp for the forwarded video in the message"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the forwarded message from forwarding and saving""" """Protects the contents of the forwarded message from forwarding and saving"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; only available when forwarding to private chats""" """Unique identifier of the message effect to be added to the message; only available when forwarding to private chats"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -48,13 +48,13 @@ class ForwardMessage(TelegramMethod[Message]):
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
from_chat_id: ChatIdUnion, from_chat_id: ChatIdUnion,
message_id: int, message_id: int,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
video_start_timestamp: Optional[DateTimeUnion] = None, video_start_timestamp: DateTimeUnion | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), protect_content: bool | Default | None = Default("protect_content"),
message_effect_id: Optional[str] = None, message_effect_id: str | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, MessageId from ..types import ChatIdUnion, MessageId
from .base import TelegramMethod from .base import TelegramMethod
@ -20,13 +20,13 @@ class ForwardMessages(TelegramMethod[list[MessageId]]):
"""Unique identifier for the chat where the original messages were sent (or channel username in the format :code:`@channelusername`)""" """Unique identifier for the chat where the original messages were sent (or channel username in the format :code:`@channelusername`)"""
message_ids: list[int] message_ids: list[int]
"""A JSON-serialized list of 1-100 identifiers of messages in the chat *from_chat_id* to forward. The identifiers must be specified in a strictly increasing order.""" """A JSON-serialized list of 1-100 identifiers of messages in the chat *from_chat_id* to forward. The identifiers must be specified in a strictly increasing order."""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the messages will be forwarded; required if the messages are forwarded to a direct messages chat""" """Identifier of the direct messages topic to which the messages will be forwarded; required if the messages are forwarded to a direct messages chat"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the messages `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the messages `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[bool] = None protect_content: bool | None = None
"""Protects the contents of the forwarded messages from forwarding and saving""" """Protects the contents of the forwarded messages from forwarding and saving"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -39,10 +39,10 @@ class ForwardMessages(TelegramMethod[list[MessageId]]):
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
from_chat_id: ChatIdUnion, from_chat_id: ChatIdUnion,
message_ids: list[int], message_ids: list[int],
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[bool] = None, protect_content: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -20,27 +20,27 @@ class GetBusinessAccountGifts(TelegramMethod[OwnedGifts]):
business_connection_id: str business_connection_id: str
"""Unique identifier of the business connection""" """Unique identifier of the business connection"""
exclude_unsaved: Optional[bool] = None exclude_unsaved: bool | None = None
"""Pass :code:`True` to exclude gifts that aren't saved to the account's profile page""" """Pass :code:`True` to exclude gifts that aren't saved to the account's profile page"""
exclude_saved: Optional[bool] = None exclude_saved: bool | None = None
"""Pass :code:`True` to exclude gifts that are saved to the account's profile page""" """Pass :code:`True` to exclude gifts that are saved to the account's profile page"""
exclude_unlimited: Optional[bool] = None exclude_unlimited: bool | None = None
"""Pass :code:`True` to exclude gifts that can be purchased an unlimited number of times""" """Pass :code:`True` to exclude gifts that can be purchased an unlimited number of times"""
exclude_limited_upgradable: Optional[bool] = None exclude_limited_upgradable: bool | None = None
"""Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can be upgraded to unique""" """Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can be upgraded to unique"""
exclude_limited_non_upgradable: Optional[bool] = None exclude_limited_non_upgradable: bool | None = None
"""Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique""" """Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique"""
exclude_unique: Optional[bool] = None exclude_unique: bool | None = None
"""Pass :code:`True` to exclude unique gifts""" """Pass :code:`True` to exclude unique gifts"""
exclude_from_blockchain: Optional[bool] = None exclude_from_blockchain: bool | None = None
"""Pass :code:`True` to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram""" """Pass :code:`True` to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram"""
sort_by_price: Optional[bool] = None sort_by_price: bool | None = None
"""Pass :code:`True` to sort results by gift price instead of send date. Sorting is applied before pagination.""" """Pass :code:`True` to sort results by gift price instead of send date. Sorting is applied before pagination."""
offset: Optional[str] = None offset: str | None = None
"""Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results""" """Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results"""
limit: Optional[int] = None limit: int | None = None
"""The maximum number of gifts to be returned; 1-100. Defaults to 100""" """The maximum number of gifts to be returned; 1-100. Defaults to 100"""
exclude_limited: Optional[bool] = Field(None, json_schema_extra={"deprecated": True}) exclude_limited: bool | None = Field(None, json_schema_extra={"deprecated": True})
"""Pass :code:`True` to exclude gifts that can be purchased a limited number of times """Pass :code:`True` to exclude gifts that can be purchased a limited number of times
.. deprecated:: API:9.3 .. deprecated:: API:9.3
@ -54,17 +54,17 @@ class GetBusinessAccountGifts(TelegramMethod[OwnedGifts]):
__pydantic__self__, __pydantic__self__,
*, *,
business_connection_id: str, business_connection_id: str,
exclude_unsaved: Optional[bool] = None, exclude_unsaved: bool | None = None,
exclude_saved: Optional[bool] = None, exclude_saved: bool | None = None,
exclude_unlimited: Optional[bool] = None, exclude_unlimited: bool | None = None,
exclude_limited_upgradable: Optional[bool] = None, exclude_limited_upgradable: bool | None = None,
exclude_limited_non_upgradable: Optional[bool] = None, exclude_limited_non_upgradable: bool | None = None,
exclude_unique: Optional[bool] = None, exclude_unique: bool | None = None,
exclude_from_blockchain: Optional[bool] = None, exclude_from_blockchain: bool | None = None,
sort_by_price: Optional[bool] = None, sort_by_price: bool | None = None,
offset: Optional[str] = None, offset: str | None = None,
limit: Optional[int] = None, limit: int | None = None,
exclude_limited: Optional[bool] = None, exclude_limited: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, OwnedGifts from ..types import ChatIdUnion, OwnedGifts
from .base import TelegramMethod from .base import TelegramMethod
@ -18,25 +18,25 @@ class GetChatGifts(TelegramMethod[OwnedGifts]):
chat_id: ChatIdUnion chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
exclude_unsaved: Optional[bool] = None exclude_unsaved: bool | None = None
"""Pass :code:`True` to exclude gifts that aren't saved to the chat's profile page. Always :code:`True`, unless the bot has the *can_post_messages* administrator right in the channel.""" """Pass :code:`True` to exclude gifts that aren't saved to the chat's profile page. Always :code:`True`, unless the bot has the *can_post_messages* administrator right in the channel."""
exclude_saved: Optional[bool] = None exclude_saved: bool | None = None
"""Pass :code:`True` to exclude gifts that are saved to the chat's profile page. Always :code:`False`, unless the bot has the *can_post_messages* administrator right in the channel.""" """Pass :code:`True` to exclude gifts that are saved to the chat's profile page. Always :code:`False`, unless the bot has the *can_post_messages* administrator right in the channel."""
exclude_unlimited: Optional[bool] = None exclude_unlimited: bool | None = None
"""Pass :code:`True` to exclude gifts that can be purchased an unlimited number of times""" """Pass :code:`True` to exclude gifts that can be purchased an unlimited number of times"""
exclude_limited_upgradable: Optional[bool] = None exclude_limited_upgradable: bool | None = None
"""Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can be upgraded to unique""" """Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can be upgraded to unique"""
exclude_limited_non_upgradable: Optional[bool] = None exclude_limited_non_upgradable: bool | None = None
"""Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique""" """Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique"""
exclude_from_blockchain: Optional[bool] = None exclude_from_blockchain: bool | None = None
"""Pass :code:`True` to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram""" """Pass :code:`True` to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram"""
exclude_unique: Optional[bool] = None exclude_unique: bool | None = None
"""Pass :code:`True` to exclude unique gifts""" """Pass :code:`True` to exclude unique gifts"""
sort_by_price: Optional[bool] = None sort_by_price: bool | None = None
"""Pass :code:`True` to sort results by gift price instead of send date. Sorting is applied before pagination.""" """Pass :code:`True` to sort results by gift price instead of send date. Sorting is applied before pagination."""
offset: Optional[str] = None offset: str | None = None
"""Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results""" """Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results"""
limit: Optional[int] = None limit: int | None = None
"""The maximum number of gifts to be returned; 1-100. Defaults to 100""" """The maximum number of gifts to be returned; 1-100. Defaults to 100"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -47,16 +47,16 @@ class GetChatGifts(TelegramMethod[OwnedGifts]):
__pydantic__self__, __pydantic__self__,
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
exclude_unsaved: Optional[bool] = None, exclude_unsaved: bool | None = None,
exclude_saved: Optional[bool] = None, exclude_saved: bool | None = None,
exclude_unlimited: Optional[bool] = None, exclude_unlimited: bool | None = None,
exclude_limited_upgradable: Optional[bool] = None, exclude_limited_upgradable: bool | None = None,
exclude_limited_non_upgradable: Optional[bool] = None, exclude_limited_non_upgradable: bool | None = None,
exclude_from_blockchain: Optional[bool] = None, exclude_from_blockchain: bool | None = None,
exclude_unique: Optional[bool] = None, exclude_unique: bool | None = None,
sort_by_price: Optional[bool] = None, sort_by_price: bool | None = None,
offset: Optional[str] = None, offset: str | None = None,
limit: Optional[int] = None, limit: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ResultMenuButtonUnion from ..types import ResultMenuButtonUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -16,7 +16,7 @@ class GetChatMenuButton(TelegramMethod[ResultMenuButtonUnion]):
__returning__ = ResultMenuButtonUnion __returning__ = ResultMenuButtonUnion
__api_method__ = "getChatMenuButton" __api_method__ = "getChatMenuButton"
chat_id: Optional[int] = None chat_id: int | None = None
"""Unique identifier for the target private chat. If not specified, default bot's menu button will be returned""" """Unique identifier for the target private chat. If not specified, default bot's menu button will be returned"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -24,7 +24,7 @@ class GetChatMenuButton(TelegramMethod[ResultMenuButtonUnion]):
# This section was auto-generated via `butcher` # This section was auto-generated via `butcher`
def __init__( def __init__(
__pydantic__self__, *, chat_id: Optional[int] = None, **__pydantic_kwargs: Any __pydantic__self__, *, chat_id: int | None = None, **__pydantic_kwargs: Any
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher` # This method was auto-generated via `butcher`

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import GameHighScore from ..types import GameHighScore
from .base import TelegramMethod from .base import TelegramMethod
@ -20,11 +20,11 @@ class GetGameHighScores(TelegramMethod[list[GameHighScore]]):
user_id: int user_id: int
"""Target user id""" """Target user id"""
chat_id: Optional[int] = None chat_id: int | None = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat""" """Required if *inline_message_id* is not specified. Unique identifier for the target chat"""
message_id: Optional[int] = None message_id: int | None = None
"""Required if *inline_message_id* is not specified. Identifier of the sent message""" """Required if *inline_message_id* is not specified. Identifier of the sent message"""
inline_message_id: Optional[str] = None inline_message_id: str | None = None
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message""" """Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -35,9 +35,9 @@ class GetGameHighScores(TelegramMethod[list[GameHighScore]]):
__pydantic__self__, __pydantic__self__,
*, *,
user_id: int, user_id: int,
chat_id: Optional[int] = None, chat_id: int | None = None,
message_id: Optional[int] = None, message_id: int | None = None,
inline_message_id: Optional[str] = None, inline_message_id: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import BotCommand, BotCommandScopeUnion from ..types import BotCommand, BotCommandScopeUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -16,9 +16,9 @@ class GetMyCommands(TelegramMethod[list[BotCommand]]):
__returning__ = list[BotCommand] __returning__ = list[BotCommand]
__api_method__ = "getMyCommands" __api_method__ = "getMyCommands"
scope: Optional[BotCommandScopeUnion] = None scope: BotCommandScopeUnion | None = None
"""A JSON-serialized object, describing scope of users. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`.""" """A JSON-serialized object, describing scope of users. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`."""
language_code: Optional[str] = None language_code: str | None = None
"""A two-letter ISO 639-1 language code or an empty string""" """A two-letter ISO 639-1 language code or an empty string"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -28,8 +28,8 @@ class GetMyCommands(TelegramMethod[list[BotCommand]]):
def __init__( def __init__(
__pydantic__self__, __pydantic__self__,
*, *,
scope: Optional[BotCommandScopeUnion] = None, scope: BotCommandScopeUnion | None = None,
language_code: Optional[str] = None, language_code: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatAdministratorRights from ..types import ChatAdministratorRights
from .base import TelegramMethod from .base import TelegramMethod
@ -16,7 +16,7 @@ class GetMyDefaultAdministratorRights(TelegramMethod[ChatAdministratorRights]):
__returning__ = ChatAdministratorRights __returning__ = ChatAdministratorRights
__api_method__ = "getMyDefaultAdministratorRights" __api_method__ = "getMyDefaultAdministratorRights"
for_channels: Optional[bool] = None for_channels: bool | None = None
"""Pass :code:`True` to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned.""" """Pass :code:`True` to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -24,7 +24,7 @@ class GetMyDefaultAdministratorRights(TelegramMethod[ChatAdministratorRights]):
# This section was auto-generated via `butcher` # This section was auto-generated via `butcher`
def __init__( def __init__(
__pydantic__self__, *, for_channels: Optional[bool] = None, **__pydantic_kwargs: Any __pydantic__self__, *, for_channels: bool | None = None, **__pydantic_kwargs: Any
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher` # This method was auto-generated via `butcher`

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import BotDescription from ..types import BotDescription
from .base import TelegramMethod from .base import TelegramMethod
@ -16,7 +16,7 @@ class GetMyDescription(TelegramMethod[BotDescription]):
__returning__ = BotDescription __returning__ = BotDescription
__api_method__ = "getMyDescription" __api_method__ = "getMyDescription"
language_code: Optional[str] = None language_code: str | None = None
"""A two-letter ISO 639-1 language code or an empty string""" """A two-letter ISO 639-1 language code or an empty string"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -24,7 +24,7 @@ class GetMyDescription(TelegramMethod[BotDescription]):
# This section was auto-generated via `butcher` # This section was auto-generated via `butcher`
def __init__( def __init__(
__pydantic__self__, *, language_code: Optional[str] = None, **__pydantic_kwargs: Any __pydantic__self__, *, language_code: str | None = None, **__pydantic_kwargs: Any
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher` # This method was auto-generated via `butcher`

View file

@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import BotName from ..types import BotName
from .base import TelegramMethod from .base import TelegramMethod
@ -14,7 +14,7 @@ class GetMyName(TelegramMethod[BotName]):
__returning__ = BotName __returning__ = BotName
__api_method__ = "getMyName" __api_method__ = "getMyName"
language_code: Optional[str] = None language_code: str | None = None
"""A two-letter ISO 639-1 language code or an empty string""" """A two-letter ISO 639-1 language code or an empty string"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -22,7 +22,7 @@ class GetMyName(TelegramMethod[BotName]):
# This section was auto-generated via `butcher` # This section was auto-generated via `butcher`
def __init__( def __init__(
__pydantic__self__, *, language_code: Optional[str] = None, **__pydantic_kwargs: Any __pydantic__self__, *, language_code: str | None = None, **__pydantic_kwargs: Any
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher` # This method was auto-generated via `butcher`

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import BotShortDescription from ..types import BotShortDescription
from .base import TelegramMethod from .base import TelegramMethod
@ -16,7 +16,7 @@ class GetMyShortDescription(TelegramMethod[BotShortDescription]):
__returning__ = BotShortDescription __returning__ = BotShortDescription
__api_method__ = "getMyShortDescription" __api_method__ = "getMyShortDescription"
language_code: Optional[str] = None language_code: str | None = None
"""A two-letter ISO 639-1 language code or an empty string""" """A two-letter ISO 639-1 language code or an empty string"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -24,7 +24,7 @@ class GetMyShortDescription(TelegramMethod[BotShortDescription]):
# This section was auto-generated via `butcher` # This section was auto-generated via `butcher`
def __init__( def __init__(
__pydantic__self__, *, language_code: Optional[str] = None, **__pydantic_kwargs: Any __pydantic__self__, *, language_code: str | None = None, **__pydantic_kwargs: Any
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher` # This method was auto-generated via `butcher`

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import StarTransactions from ..types import StarTransactions
from .base import TelegramMethod from .base import TelegramMethod
@ -16,9 +16,9 @@ class GetStarTransactions(TelegramMethod[StarTransactions]):
__returning__ = StarTransactions __returning__ = StarTransactions
__api_method__ = "getStarTransactions" __api_method__ = "getStarTransactions"
offset: Optional[int] = None offset: int | None = None
"""Number of transactions to skip in the response""" """Number of transactions to skip in the response"""
limit: Optional[int] = None limit: int | None = None
"""The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.""" """The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -28,8 +28,8 @@ class GetStarTransactions(TelegramMethod[StarTransactions]):
def __init__( def __init__(
__pydantic__self__, __pydantic__self__,
*, *,
offset: Optional[int] = None, offset: int | None = None,
limit: Optional[int] = None, limit: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import Update from ..types import Update
from .base import TelegramMethod from .base import TelegramMethod
@ -22,13 +22,13 @@ class GetUpdates(TelegramMethod[list[Update]]):
__returning__ = list[Update] __returning__ = list[Update]
__api_method__ = "getUpdates" __api_method__ = "getUpdates"
offset: Optional[int] = None offset: int | None = None
"""Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as :class:`aiogram.methods.get_updates.GetUpdates` is called with an *offset* higher than its *update_id*. The negative offset can be specified to retrieve updates starting from *-offset* update from the end of the updates queue. All previous updates will be forgotten.""" """Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as :class:`aiogram.methods.get_updates.GetUpdates` is called with an *offset* higher than its *update_id*. The negative offset can be specified to retrieve updates starting from *-offset* update from the end of the updates queue. All previous updates will be forgotten."""
limit: Optional[int] = None limit: int | None = None
"""Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.""" """Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100."""
timeout: Optional[int] = None timeout: int | None = None
"""Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.""" """Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only."""
allowed_updates: Optional[list[str]] = None allowed_updates: list[str] | None = None
"""A JSON-serialized list of the update types you want your bot to receive. For example, specify :code:`["message", "edited_channel_post", "callback_query"]` to only receive updates of these types. See :class:`aiogram.types.update.Update` for a complete list of available update types. Specify an empty list to receive all update types except *chat_member*, *message_reaction*, and *message_reaction_count* (default). If not specified, the previous setting will be used.""" """A JSON-serialized list of the update types you want your bot to receive. For example, specify :code:`["message", "edited_channel_post", "callback_query"]` to only receive updates of these types. See :class:`aiogram.types.update.Update` for a complete list of available update types. Specify an empty list to receive all update types except *chat_member*, *message_reaction*, and *message_reaction_count* (default). If not specified, the previous setting will be used."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -38,10 +38,10 @@ class GetUpdates(TelegramMethod[list[Update]]):
def __init__( def __init__(
__pydantic__self__, __pydantic__self__,
*, *,
offset: Optional[int] = None, offset: int | None = None,
limit: Optional[int] = None, limit: int | None = None,
timeout: Optional[int] = None, timeout: int | None = None,
allowed_updates: Optional[list[str]] = None, allowed_updates: list[str] | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import OwnedGifts from ..types import OwnedGifts
from .base import TelegramMethod from .base import TelegramMethod
@ -18,21 +18,21 @@ class GetUserGifts(TelegramMethod[OwnedGifts]):
user_id: int user_id: int
"""Unique identifier of the user""" """Unique identifier of the user"""
exclude_unlimited: Optional[bool] = None exclude_unlimited: bool | None = None
"""Pass :code:`True` to exclude gifts that can be purchased an unlimited number of times""" """Pass :code:`True` to exclude gifts that can be purchased an unlimited number of times"""
exclude_limited_upgradable: Optional[bool] = None exclude_limited_upgradable: bool | None = None
"""Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can be upgraded to unique""" """Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can be upgraded to unique"""
exclude_limited_non_upgradable: Optional[bool] = None exclude_limited_non_upgradable: bool | None = None
"""Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique""" """Pass :code:`True` to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique"""
exclude_from_blockchain: Optional[bool] = None exclude_from_blockchain: bool | None = None
"""Pass :code:`True` to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram""" """Pass :code:`True` to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram"""
exclude_unique: Optional[bool] = None exclude_unique: bool | None = None
"""Pass :code:`True` to exclude unique gifts""" """Pass :code:`True` to exclude unique gifts"""
sort_by_price: Optional[bool] = None sort_by_price: bool | None = None
"""Pass :code:`True` to sort results by gift price instead of send date. Sorting is applied before pagination.""" """Pass :code:`True` to sort results by gift price instead of send date. Sorting is applied before pagination."""
offset: Optional[str] = None offset: str | None = None
"""Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results""" """Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results"""
limit: Optional[int] = None limit: int | None = None
"""The maximum number of gifts to be returned; 1-100. Defaults to 100""" """The maximum number of gifts to be returned; 1-100. Defaults to 100"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -43,14 +43,14 @@ class GetUserGifts(TelegramMethod[OwnedGifts]):
__pydantic__self__, __pydantic__self__,
*, *,
user_id: int, user_id: int,
exclude_unlimited: Optional[bool] = None, exclude_unlimited: bool | None = None,
exclude_limited_upgradable: Optional[bool] = None, exclude_limited_upgradable: bool | None = None,
exclude_limited_non_upgradable: Optional[bool] = None, exclude_limited_non_upgradable: bool | None = None,
exclude_from_blockchain: Optional[bool] = None, exclude_from_blockchain: bool | None = None,
exclude_unique: Optional[bool] = None, exclude_unique: bool | None = None,
sort_by_price: Optional[bool] = None, sort_by_price: bool | None = None,
offset: Optional[str] = None, offset: str | None = None,
limit: Optional[int] = None, limit: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import UserProfilePhotos from ..types import UserProfilePhotos
from .base import TelegramMethod from .base import TelegramMethod
@ -18,9 +18,9 @@ class GetUserProfilePhotos(TelegramMethod[UserProfilePhotos]):
user_id: int user_id: int
"""Unique identifier of the target user""" """Unique identifier of the target user"""
offset: Optional[int] = None offset: int | None = None
"""Sequential number of the first photo to be returned. By default, all photos are returned.""" """Sequential number of the first photo to be returned. By default, all photos are returned."""
limit: Optional[int] = None limit: int | None = None
"""Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100.""" """Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -31,8 +31,8 @@ class GetUserProfilePhotos(TelegramMethod[UserProfilePhotos]):
__pydantic__self__, __pydantic__self__,
*, *,
user_id: int, user_id: int,
offset: Optional[int] = None, offset: int | None = None,
limit: Optional[int] = None, limit: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import MessageEntity from ..types import MessageEntity
from .base import TelegramMethod from .base import TelegramMethod
@ -22,11 +22,11 @@ class GiftPremiumSubscription(TelegramMethod[bool]):
"""Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12""" """Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12"""
star_count: int star_count: int
"""Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months""" """Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months"""
text: Optional[str] = None text: str | None = None
"""Text that will be shown along with the service message about the subscription; 0-128 characters""" """Text that will be shown along with the service message about the subscription; 0-128 characters"""
text_parse_mode: Optional[str] = None text_parse_mode: str | None = None
"""Mode for parsing entities in the text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.""" """Mode for parsing entities in the text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored."""
text_entities: Optional[list[MessageEntity]] = None text_entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of *text_parse_mode*. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.""" """A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of *text_parse_mode*. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -39,9 +39,9 @@ class GiftPremiumSubscription(TelegramMethod[bool]):
user_id: int, user_id: int,
month_count: int, month_count: int,
star_count: int, star_count: int,
text: Optional[str] = None, text: str | None = None,
text_parse_mode: Optional[str] = None, text_parse_mode: str | None = None,
text_entities: Optional[list[MessageEntity]] = None, text_entities: list[MessageEntity] | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion from ..types import ChatIdUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -20,9 +20,9 @@ class PinChatMessage(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: int message_id: int
"""Identifier of a message to pin""" """Identifier of a message to pin"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be pinned""" """Unique identifier of the business connection on behalf of which the message will be pinned"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Pass :code:`True` if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats.""" """Pass :code:`True` if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -34,8 +34,8 @@ class PinChatMessage(TelegramMethod[bool]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
message_id: int, message_id: int,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import InputStoryContentUnion, MessageEntity, Story, StoryArea from ..types import InputStoryContentUnion, MessageEntity, Story, StoryArea
from .base import TelegramMethod from .base import TelegramMethod
@ -22,17 +22,17 @@ class PostStory(TelegramMethod[Story]):
"""Content of the story""" """Content of the story"""
active_period: int active_period: int
"""Period after which the story is moved to the archive, in seconds; must be one of :code:`6 * 3600`, :code:`12 * 3600`, :code:`86400`, or :code:`2 * 86400`""" """Period after which the story is moved to the archive, in seconds; must be one of :code:`6 * 3600`, :code:`12 * 3600`, :code:`86400`, or :code:`2 * 86400`"""
caption: Optional[str] = None caption: str | None = None
"""Caption of the story, 0-2048 characters after entities parsing""" """Caption of the story, 0-2048 characters after entities parsing"""
parse_mode: Optional[str] = None parse_mode: str | None = None
"""Mode for parsing entities in the story caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.""" """Mode for parsing entities in the story caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[list[MessageEntity]] = None caption_entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
areas: Optional[list[StoryArea]] = None areas: list[StoryArea] | None = None
"""A JSON-serialized list of clickable areas to be shown on the story""" """A JSON-serialized list of clickable areas to be shown on the story"""
post_to_chat_page: Optional[bool] = None post_to_chat_page: bool | None = None
"""Pass :code:`True` to keep the story accessible after it expires""" """Pass :code:`True` to keep the story accessible after it expires"""
protect_content: Optional[bool] = None protect_content: bool | None = None
"""Pass :code:`True` if the content of the story must be protected from forwarding and screenshotting""" """Pass :code:`True` if the content of the story must be protected from forwarding and screenshotting"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -45,12 +45,12 @@ class PostStory(TelegramMethod[Story]):
business_connection_id: str, business_connection_id: str,
content: InputStoryContentUnion, content: InputStoryContentUnion,
active_period: int, active_period: int,
caption: Optional[str] = None, caption: str | None = None,
parse_mode: Optional[str] = None, parse_mode: str | None = None,
caption_entities: Optional[list[MessageEntity]] = None, caption_entities: list[MessageEntity] | None = None,
areas: Optional[list[StoryArea]] = None, areas: list[StoryArea] | None = None,
post_to_chat_page: Optional[bool] = None, post_to_chat_page: bool | None = None,
protect_content: Optional[bool] = None, protect_content: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion from ..types import ChatIdUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -20,37 +20,37 @@ class PromoteChatMember(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
user_id: int user_id: int
"""Unique identifier of the target user""" """Unique identifier of the target user"""
is_anonymous: Optional[bool] = None is_anonymous: bool | None = None
"""Pass :code:`True` if the administrator's presence in the chat is hidden""" """Pass :code:`True` if the administrator's presence in the chat is hidden"""
can_manage_chat: Optional[bool] = None can_manage_chat: bool | None = None
"""Pass :code:`True` if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege.""" """Pass :code:`True` if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege."""
can_delete_messages: Optional[bool] = None can_delete_messages: bool | None = None
"""Pass :code:`True` if the administrator can delete messages of other users""" """Pass :code:`True` if the administrator can delete messages of other users"""
can_manage_video_chats: Optional[bool] = None can_manage_video_chats: bool | None = None
"""Pass :code:`True` if the administrator can manage video chats""" """Pass :code:`True` if the administrator can manage video chats"""
can_restrict_members: Optional[bool] = None can_restrict_members: bool | None = None
"""Pass :code:`True` if the administrator can restrict, ban or unban chat members, or access supergroup statistics. For backward compatibility, defaults to :code:`True` for promotions of channel administrators""" """Pass :code:`True` if the administrator can restrict, ban or unban chat members, or access supergroup statistics. For backward compatibility, defaults to :code:`True` for promotions of channel administrators"""
can_promote_members: Optional[bool] = None can_promote_members: bool | None = None
"""Pass :code:`True` if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)""" """Pass :code:`True` if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)"""
can_change_info: Optional[bool] = None can_change_info: bool | None = None
"""Pass :code:`True` if the administrator can change chat title, photo and other settings""" """Pass :code:`True` if the administrator can change chat title, photo and other settings"""
can_invite_users: Optional[bool] = None can_invite_users: bool | None = None
"""Pass :code:`True` if the administrator can invite new users to the chat""" """Pass :code:`True` if the administrator can invite new users to the chat"""
can_post_stories: Optional[bool] = None can_post_stories: bool | None = None
"""Pass :code:`True` if the administrator can post stories to the chat""" """Pass :code:`True` if the administrator can post stories to the chat"""
can_edit_stories: Optional[bool] = None can_edit_stories: bool | None = None
"""Pass :code:`True` if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive""" """Pass :code:`True` if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive"""
can_delete_stories: Optional[bool] = None can_delete_stories: bool | None = None
"""Pass :code:`True` if the administrator can delete stories posted by other users""" """Pass :code:`True` if the administrator can delete stories posted by other users"""
can_post_messages: Optional[bool] = None can_post_messages: bool | None = None
"""Pass :code:`True` if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only""" """Pass :code:`True` if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only"""
can_edit_messages: Optional[bool] = None can_edit_messages: bool | None = None
"""Pass :code:`True` if the administrator can edit messages of other users and can pin messages; for channels only""" """Pass :code:`True` if the administrator can edit messages of other users and can pin messages; for channels only"""
can_pin_messages: Optional[bool] = None can_pin_messages: bool | None = None
"""Pass :code:`True` if the administrator can pin messages; for supergroups only""" """Pass :code:`True` if the administrator can pin messages; for supergroups only"""
can_manage_topics: Optional[bool] = None can_manage_topics: bool | None = None
"""Pass :code:`True` if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only""" """Pass :code:`True` if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only"""
can_manage_direct_messages: Optional[bool] = None can_manage_direct_messages: bool | None = None
"""Pass :code:`True` if the administrator can manage direct messages within the channel and decline suggested posts; for channels only""" """Pass :code:`True` if the administrator can manage direct messages within the channel and decline suggested posts; for channels only"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -62,22 +62,22 @@ class PromoteChatMember(TelegramMethod[bool]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
user_id: int, user_id: int,
is_anonymous: Optional[bool] = None, is_anonymous: bool | None = None,
can_manage_chat: Optional[bool] = None, can_manage_chat: bool | None = None,
can_delete_messages: Optional[bool] = None, can_delete_messages: bool | None = None,
can_manage_video_chats: Optional[bool] = None, can_manage_video_chats: bool | None = None,
can_restrict_members: Optional[bool] = None, can_restrict_members: bool | None = None,
can_promote_members: Optional[bool] = None, can_promote_members: bool | None = None,
can_change_info: Optional[bool] = None, can_change_info: bool | None = None,
can_invite_users: Optional[bool] = None, can_invite_users: bool | None = None,
can_post_stories: Optional[bool] = None, can_post_stories: bool | None = None,
can_edit_stories: Optional[bool] = None, can_edit_stories: bool | None = None,
can_delete_stories: Optional[bool] = None, can_delete_stories: bool | None = None,
can_post_messages: Optional[bool] = None, can_post_messages: bool | None = None,
can_edit_messages: Optional[bool] = None, can_edit_messages: bool | None = None,
can_pin_messages: Optional[bool] = None, can_pin_messages: bool | None = None,
can_manage_topics: Optional[bool] = None, can_manage_topics: bool | None = None,
can_manage_direct_messages: Optional[bool] = None, can_manage_direct_messages: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from .base import TelegramMethod from .base import TelegramMethod
@ -17,7 +17,7 @@ class RemoveBusinessAccountProfilePhoto(TelegramMethod[bool]):
business_connection_id: str business_connection_id: str
"""Unique identifier of the business connection""" """Unique identifier of the business connection"""
is_public: Optional[bool] = None is_public: bool | None = None
"""Pass :code:`True` to remove the public photo, which is visible even if the main photo is hidden by the business account's privacy settings. After the main photo is removed, the previous profile photo (if present) becomes the main photo.""" """Pass :code:`True` to remove the public photo, which is visible even if the main photo is hidden by the business account's privacy settings. After the main photo is removed, the previous profile photo (if present) becomes the main photo."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -28,7 +28,7 @@ class RemoveBusinessAccountProfilePhoto(TelegramMethod[bool]):
__pydantic__self__, __pydantic__self__,
*, *,
business_connection_id: str, business_connection_id: str,
is_public: Optional[bool] = None, is_public: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import Story from ..types import Story
from .base import TelegramMethod from .base import TelegramMethod
@ -24,9 +24,9 @@ class RepostStory(TelegramMethod[Story]):
"""Unique identifier of the story that should be reposted""" """Unique identifier of the story that should be reposted"""
active_period: int active_period: int
"""Period after which the story is moved to the archive, in seconds; must be one of :code:`6 * 3600`, :code:`12 * 3600`, :code:`86400`, or :code:`2 * 86400`""" """Period after which the story is moved to the archive, in seconds; must be one of :code:`6 * 3600`, :code:`12 * 3600`, :code:`86400`, or :code:`2 * 86400`"""
post_to_chat_page: Optional[bool] = None post_to_chat_page: bool | None = None
"""Pass :code:`True` to keep the story accessible after it expires""" """Pass :code:`True` to keep the story accessible after it expires"""
protect_content: Optional[bool] = None protect_content: bool | None = None
"""Pass :code:`True` if the content of the story must be protected from forwarding and screenshotting""" """Pass :code:`True` if the content of the story must be protected from forwarding and screenshotting"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -40,8 +40,8 @@ class RepostStory(TelegramMethod[Story]):
from_chat_id: int, from_chat_id: int,
from_story_id: int, from_story_id: int,
active_period: int, active_period: int,
post_to_chat_page: Optional[bool] = None, post_to_chat_page: bool | None = None,
protect_content: Optional[bool] = None, protect_content: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, ChatPermissions, DateTimeUnion from ..types import ChatIdUnion, ChatPermissions, DateTimeUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -22,9 +22,9 @@ class RestrictChatMember(TelegramMethod[bool]):
"""Unique identifier of the target user""" """Unique identifier of the target user"""
permissions: ChatPermissions permissions: ChatPermissions
"""A JSON-serialized object for new user permissions""" """A JSON-serialized object for new user permissions"""
use_independent_chat_permissions: Optional[bool] = None use_independent_chat_permissions: bool | None = None
"""Pass :code:`True` if chat permissions are set independently. Otherwise, the *can_send_other_messages* and *can_add_web_page_previews* permissions will imply the *can_send_messages*, *can_send_audios*, *can_send_documents*, *can_send_photos*, *can_send_videos*, *can_send_video_notes*, and *can_send_voice_notes* permissions; the *can_send_polls* permission will imply the *can_send_messages* permission.""" """Pass :code:`True` if chat permissions are set independently. Otherwise, the *can_send_other_messages* and *can_add_web_page_previews* permissions will imply the *can_send_messages*, *can_send_audios*, *can_send_documents*, *can_send_photos*, *can_send_videos*, *can_send_video_notes*, and *can_send_voice_notes* permissions; the *can_send_polls* permission will imply the *can_send_messages* permission."""
until_date: Optional[DateTimeUnion] = None until_date: DateTimeUnion | None = None
"""Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever""" """Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -37,8 +37,8 @@ class RestrictChatMember(TelegramMethod[bool]):
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
user_id: int, user_id: int,
permissions: ChatPermissions, permissions: ChatPermissions,
use_independent_chat_permissions: Optional[bool] = None, use_independent_chat_permissions: bool | None = None,
until_date: Optional[DateTimeUnion] = None, until_date: DateTimeUnion | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import InlineQueryResultUnion, PreparedInlineMessage from ..types import InlineQueryResultUnion, PreparedInlineMessage
from .base import TelegramMethod from .base import TelegramMethod
@ -20,13 +20,13 @@ class SavePreparedInlineMessage(TelegramMethod[PreparedInlineMessage]):
"""Unique identifier of the target user that can use the prepared message""" """Unique identifier of the target user that can use the prepared message"""
result: InlineQueryResultUnion result: InlineQueryResultUnion
"""A JSON-serialized object describing the message to be sent""" """A JSON-serialized object describing the message to be sent"""
allow_user_chats: Optional[bool] = None allow_user_chats: bool | None = None
"""Pass :code:`True` if the message can be sent to private chats with users""" """Pass :code:`True` if the message can be sent to private chats with users"""
allow_bot_chats: Optional[bool] = None allow_bot_chats: bool | None = None
"""Pass :code:`True` if the message can be sent to private chats with bots""" """Pass :code:`True` if the message can be sent to private chats with bots"""
allow_group_chats: Optional[bool] = None allow_group_chats: bool | None = None
"""Pass :code:`True` if the message can be sent to group and supergroup chats""" """Pass :code:`True` if the message can be sent to group and supergroup chats"""
allow_channel_chats: Optional[bool] = None allow_channel_chats: bool | None = None
"""Pass :code:`True` if the message can be sent to channel chats""" """Pass :code:`True` if the message can be sent to channel chats"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -38,10 +38,10 @@ class SavePreparedInlineMessage(TelegramMethod[PreparedInlineMessage]):
*, *,
user_id: int, user_id: int,
result: InlineQueryResultUnion, result: InlineQueryResultUnion,
allow_user_chats: Optional[bool] = None, allow_user_chats: bool | None = None,
allow_bot_chats: Optional[bool] = None, allow_bot_chats: bool | None = None,
allow_group_chats: Optional[bool] = None, allow_group_chats: bool | None = None,
allow_channel_chats: Optional[bool] = None, allow_channel_chats: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -32,52 +32,50 @@ class SendAnimation(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
animation: InputFileUnion animation: InputFileUnion
"""Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`""" """Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
duration: Optional[int] = None duration: int | None = None
"""Duration of sent animation in seconds""" """Duration of sent animation in seconds"""
width: Optional[int] = None width: int | None = None
"""Animation width""" """Animation width"""
height: Optional[int] = None height: int | None = None
"""Animation height""" """Animation height"""
thumbnail: Optional[InputFile] = None thumbnail: InputFile | None = None
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`""" """Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
caption: Optional[str] = None caption: str | None = None
"""Animation caption (may also be used when resending animation by *file_id*), 0-1024 characters after entities parsing""" """Animation caption (may also be used when resending animation by *file_id*), 0-1024 characters after entities parsing"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode") parse_mode: str | Default | None = Default("parse_mode")
"""Mode for parsing entities in the animation caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.""" """Mode for parsing entities in the animation caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[list[MessageEntity]] = None caption_entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") show_caption_above_media: bool | Default | None = Default("show_caption_above_media")
"""Pass :code:`True`, if the caption must be shown above the message media""" """Pass :code:`True`, if the caption must be shown above the message media"""
has_spoiler: Optional[bool] = None has_spoiler: bool | None = None
"""Pass :code:`True` if the animation needs to be covered with a spoiler animation""" """Pass :code:`True` if the animation needs to be covered with a spoiler animation"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None reply_markup: ReplyMarkupUnion | None = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user""" """Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -92,29 +90,27 @@ class SendAnimation(TelegramMethod[Message]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
animation: InputFileUnion, animation: InputFileUnion,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
duration: Optional[int] = None, duration: int | None = None,
width: Optional[int] = None, width: int | None = None,
height: Optional[int] = None, height: int | None = None,
thumbnail: Optional[InputFile] = None, thumbnail: InputFile | None = None,
caption: Optional[str] = None, caption: str | None = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), parse_mode: str | Default | None = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None, caption_entities: list[MessageEntity] | None = None,
show_caption_above_media: Optional[Union[bool, Default]] = Default( show_caption_above_media: bool | Default | None = Default("show_caption_above_media"),
"show_caption_above_media" has_spoiler: bool | None = None,
), disable_notification: bool | None = None,
has_spoiler: Optional[bool] = None, protect_content: bool | Default | None = Default("protect_content"),
disable_notification: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), message_effect_id: str | None = None,
allow_paid_broadcast: Optional[bool] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
message_effect_id: Optional[str] = None, reply_parameters: ReplyParameters | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, reply_markup: ReplyMarkupUnion | None = None,
reply_parameters: Optional[ReplyParameters] = None, allow_sending_without_reply: bool | None = None,
reply_markup: Optional[ReplyMarkupUnion] = None, reply_to_message_id: int | None = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -33,48 +33,46 @@ class SendAudio(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
audio: InputFileUnion audio: InputFileUnion
"""Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`""" """Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
caption: Optional[str] = None caption: str | None = None
"""Audio caption, 0-1024 characters after entities parsing""" """Audio caption, 0-1024 characters after entities parsing"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode") parse_mode: str | Default | None = Default("parse_mode")
"""Mode for parsing entities in the audio caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.""" """Mode for parsing entities in the audio caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[list[MessageEntity]] = None caption_entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
duration: Optional[int] = None duration: int | None = None
"""Duration of the audio in seconds""" """Duration of the audio in seconds"""
performer: Optional[str] = None performer: str | None = None
"""Performer""" """Performer"""
title: Optional[str] = None title: str | None = None
"""Track name""" """Track name"""
thumbnail: Optional[InputFile] = None thumbnail: InputFile | None = None
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`""" """Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None reply_markup: ReplyMarkupUnion | None = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user""" """Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -89,25 +87,25 @@ class SendAudio(TelegramMethod[Message]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
audio: InputFileUnion, audio: InputFileUnion,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
caption: Optional[str] = None, caption: str | None = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), parse_mode: str | Default | None = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None, caption_entities: list[MessageEntity] | None = None,
duration: Optional[int] = None, duration: int | None = None,
performer: Optional[str] = None, performer: str | None = None,
title: Optional[str] = None, title: str | None = None,
thumbnail: Optional[InputFile] = None, thumbnail: InputFile | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), protect_content: bool | Default | None = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
message_effect_id: Optional[str] = None, message_effect_id: str | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
reply_parameters: Optional[ReplyParameters] = None, reply_parameters: ReplyParameters | None = None,
reply_markup: Optional[ReplyMarkupUnion] = None, reply_markup: ReplyMarkupUnion | None = None,
allow_sending_without_reply: Optional[bool] = None, allow_sending_without_reply: bool | None = None,
reply_to_message_id: Optional[int] = None, reply_to_message_id: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion from ..types import ChatIdUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -24,9 +24,9 @@ class SendChatAction(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`). Channel chats and channel direct messages chats aren't supported.""" """Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`). Channel chats and channel direct messages chats aren't supported."""
action: str action: str
"""Type of action to broadcast. Choose one, depending on what the user is about to receive: *typing* for `text messages <https://core.telegram.org/bots/api#sendmessage>`_, *upload_photo* for `photos <https://core.telegram.org/bots/api#sendphoto>`_, *record_video* or *upload_video* for `videos <https://core.telegram.org/bots/api#sendvideo>`_, *record_voice* or *upload_voice* for `voice notes <https://core.telegram.org/bots/api#sendvoice>`_, *upload_document* for `general files <https://core.telegram.org/bots/api#senddocument>`_, *choose_sticker* for `stickers <https://core.telegram.org/bots/api#sendsticker>`_, *find_location* for `location data <https://core.telegram.org/bots/api#sendlocation>`_, *record_video_note* or *upload_video_note* for `video notes <https://core.telegram.org/bots/api#sendvideonote>`_.""" """Type of action to broadcast. Choose one, depending on what the user is about to receive: *typing* for `text messages <https://core.telegram.org/bots/api#sendmessage>`_, *upload_photo* for `photos <https://core.telegram.org/bots/api#sendphoto>`_, *record_video* or *upload_video* for `videos <https://core.telegram.org/bots/api#sendvideo>`_, *record_voice* or *upload_voice* for `voice notes <https://core.telegram.org/bots/api#sendvoice>`_, *upload_document* for `general files <https://core.telegram.org/bots/api#senddocument>`_, *choose_sticker* for `stickers <https://core.telegram.org/bots/api#sendsticker>`_, *find_location* for `location data <https://core.telegram.org/bots/api#sendlocation>`_, *record_video_note* or *upload_video_note* for `video notes <https://core.telegram.org/bots/api#sendvideonote>`_."""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the action will be sent""" """Unique identifier of the business connection on behalf of which the action will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread or topic of a forum; for supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread or topic of a forum; for supergroups and private chats of bots with forum topic mode enabled only"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -38,8 +38,8 @@ class SendChatAction(TelegramMethod[bool]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
action: str, action: str,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import InlineKeyboardMarkup, InputChecklist, Message, ReplyParameters from ..types import InlineKeyboardMarkup, InputChecklist, Message, ReplyParameters
from .base import TelegramMethod from .base import TelegramMethod
@ -22,15 +22,15 @@ class SendChecklist(TelegramMethod[Message]):
"""Unique identifier for the target chat""" """Unique identifier for the target chat"""
checklist: InputChecklist checklist: InputChecklist
"""A JSON-serialized object for the checklist to send""" """A JSON-serialized object for the checklist to send"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message silently. Users will receive a notification with no sound.""" """Sends the message silently. Users will receive a notification with no sound."""
protect_content: Optional[bool] = None protect_content: bool | None = None
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message""" """Unique identifier of the message effect to be added to the message"""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""A JSON-serialized object for description of the message to reply to""" """A JSON-serialized object for description of the message to reply to"""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: InlineKeyboardMarkup | None = None
"""A JSON-serialized object for an inline keyboard""" """A JSON-serialized object for an inline keyboard"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -43,11 +43,11 @@ class SendChecklist(TelegramMethod[Message]):
business_connection_id: str, business_connection_id: str,
chat_id: int, chat_id: int,
checklist: InputChecklist, checklist: InputChecklist,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[bool] = None, protect_content: bool | None = None,
message_effect_id: Optional[str] = None, message_effect_id: str | None = None,
reply_parameters: Optional[ReplyParameters] = None, reply_parameters: ReplyParameters | None = None,
reply_markup: Optional[InlineKeyboardMarkup] = None, reply_markup: InlineKeyboardMarkup | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -31,38 +31,36 @@ class SendContact(TelegramMethod[Message]):
"""Contact's phone number""" """Contact's phone number"""
first_name: str first_name: str
"""Contact's first name""" """Contact's first name"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
last_name: Optional[str] = None last_name: str | None = None
"""Contact's last name""" """Contact's last name"""
vcard: Optional[str] = None vcard: str | None = None
"""Additional data about the contact in the form of a `vCard <https://en.wikipedia.org/wiki/VCard>`_, 0-2048 bytes""" """Additional data about the contact in the form of a `vCard <https://en.wikipedia.org/wiki/VCard>`_, 0-2048 bytes"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None reply_markup: ReplyMarkupUnion | None = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user""" """Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -78,20 +76,20 @@ class SendContact(TelegramMethod[Message]):
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
phone_number: str, phone_number: str,
first_name: str, first_name: str,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
last_name: Optional[str] = None, last_name: str | None = None,
vcard: Optional[str] = None, vcard: str | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), protect_content: bool | Default | None = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
message_effect_id: Optional[str] = None, message_effect_id: str | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
reply_parameters: Optional[ReplyParameters] = None, reply_parameters: ReplyParameters | None = None,
reply_markup: Optional[ReplyMarkupUnion] = None, reply_markup: ReplyMarkupUnion | None = None,
allow_sending_without_reply: Optional[bool] = None, allow_sending_without_reply: bool | None = None,
reply_to_message_id: Optional[int] = None, reply_to_message_id: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -27,36 +27,34 @@ class SendDice(TelegramMethod[Message]):
chat_id: ChatIdUnion chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
emoji: Optional[str] = None emoji: str | None = None
"""Emoji on which the dice throw animation is based. Currently, must be one of '🎲', '🎯', '🏀', '', '🎳', or '🎰'. Dice can have values 1-6 for '🎲', '🎯' and '🎳', values 1-5 for '🏀' and '', and values 1-64 for '🎰'. Defaults to '🎲'""" """Emoji on which the dice throw animation is based. Currently, must be one of '🎲', '🎯', '🏀', '', '🎳', or '🎰'. Dice can have values 1-6 for '🎲', '🎯' and '🎳', values 1-5 for '🏀' and '', and values 1-64 for '🎰'. Defaults to '🎲'"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding""" """Protects the contents of the sent message from forwarding"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None reply_markup: ReplyMarkupUnion | None = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user""" """Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -70,19 +68,19 @@ class SendDice(TelegramMethod[Message]):
__pydantic__self__, __pydantic__self__,
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
emoji: Optional[str] = None, emoji: str | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), protect_content: bool | Default | None = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
message_effect_id: Optional[str] = None, message_effect_id: str | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
reply_parameters: Optional[ReplyParameters] = None, reply_parameters: ReplyParameters | None = None,
reply_markup: Optional[ReplyMarkupUnion] = None, reply_markup: ReplyMarkupUnion | None = None,
allow_sending_without_reply: Optional[bool] = None, allow_sending_without_reply: bool | None = None,
reply_to_message_id: Optional[int] = None, reply_to_message_id: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -32,44 +32,42 @@ class SendDocument(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
document: InputFileUnion document: InputFileUnion
"""File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`""" """File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
thumbnail: Optional[InputFile] = None thumbnail: InputFile | None = None
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`""" """Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
caption: Optional[str] = None caption: str | None = None
"""Document caption (may also be used when resending documents by *file_id*), 0-1024 characters after entities parsing""" """Document caption (may also be used when resending documents by *file_id*), 0-1024 characters after entities parsing"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode") parse_mode: str | Default | None = Default("parse_mode")
"""Mode for parsing entities in the document caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.""" """Mode for parsing entities in the document caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[list[MessageEntity]] = None caption_entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
disable_content_type_detection: Optional[bool] = None disable_content_type_detection: bool | None = None
"""Disables automatic server-side content type detection for files uploaded using multipart/form-data""" """Disables automatic server-side content type detection for files uploaded using multipart/form-data"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None reply_markup: ReplyMarkupUnion | None = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user""" """Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -84,23 +82,23 @@ class SendDocument(TelegramMethod[Message]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
document: InputFileUnion, document: InputFileUnion,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
thumbnail: Optional[InputFile] = None, thumbnail: InputFile | None = None,
caption: Optional[str] = None, caption: str | None = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), parse_mode: str | Default | None = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None, caption_entities: list[MessageEntity] | None = None,
disable_content_type_detection: Optional[bool] = None, disable_content_type_detection: bool | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), protect_content: bool | Default | None = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
message_effect_id: Optional[str] = None, message_effect_id: str | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
reply_parameters: Optional[ReplyParameters] = None, reply_parameters: ReplyParameters | None = None,
reply_markup: Optional[ReplyMarkupUnion] = None, reply_markup: ReplyMarkupUnion | None = None,
allow_sending_without_reply: Optional[bool] = None, allow_sending_without_reply: bool | None = None,
reply_to_message_id: Optional[int] = None, reply_to_message_id: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -23,30 +23,28 @@ class SendGame(TelegramMethod[Message]):
"""Unique identifier for the target chat. Games can't be sent to channel direct messages chats and channel chats.""" """Unique identifier for the target chat. Games can't be sent to channel direct messages chats and channel chats."""
game_short_name: str game_short_name: str
"""Short name of the game, serves as the unique identifier for the game. Set up your games via `@BotFather <https://t.me/botfather>`_.""" """Short name of the game, serves as the unique identifier for the game. Set up your games via `@BotFather <https://t.me/botfather>`_."""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: InlineKeyboardMarkup | None = None
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game.""" """A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game."""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -61,16 +59,16 @@ class SendGame(TelegramMethod[Message]):
*, *,
chat_id: int, chat_id: int,
game_short_name: str, game_short_name: str,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), protect_content: bool | Default | None = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
message_effect_id: Optional[str] = None, message_effect_id: str | None = None,
reply_parameters: Optional[ReplyParameters] = None, reply_parameters: ReplyParameters | None = None,
reply_markup: Optional[InlineKeyboardMarkup] = None, reply_markup: InlineKeyboardMarkup | None = None,
allow_sending_without_reply: Optional[bool] = None, allow_sending_without_reply: bool | None = None,
reply_to_message_id: Optional[int] = None, reply_to_message_id: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion from ..types import ChatIdUnion
from ..types.message_entity import MessageEntity from ..types.message_entity import MessageEntity
@ -19,17 +19,17 @@ class SendGift(TelegramMethod[bool]):
gift_id: str gift_id: str
"""Identifier of the gift; limited gifts can't be sent to channel chats""" """Identifier of the gift; limited gifts can't be sent to channel chats"""
user_id: Optional[int] = None user_id: int | None = None
"""Required if *chat_id* is not specified. Unique identifier of the target user who will receive the gift.""" """Required if *chat_id* is not specified. Unique identifier of the target user who will receive the gift."""
chat_id: Optional[ChatIdUnion] = None chat_id: ChatIdUnion | None = None
"""Required if *user_id* is not specified. Unique identifier for the chat or username of the channel (in the format :code:`@channelusername`) that will receive the gift.""" """Required if *user_id* is not specified. Unique identifier for the chat or username of the channel (in the format :code:`@channelusername`) that will receive the gift."""
pay_for_upgrade: Optional[bool] = None pay_for_upgrade: bool | None = None
"""Pass :code:`True` to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver""" """Pass :code:`True` to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver"""
text: Optional[str] = None text: str | None = None
"""Text that will be shown along with the gift; 0-128 characters""" """Text that will be shown along with the gift; 0-128 characters"""
text_parse_mode: Optional[str] = None text_parse_mode: str | None = None
"""Mode for parsing entities in the text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.""" """Mode for parsing entities in the text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored."""
text_entities: Optional[list[MessageEntity]] = None text_entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of *text_parse_mode*. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.""" """A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of *text_parse_mode*. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -40,12 +40,12 @@ class SendGift(TelegramMethod[bool]):
__pydantic__self__, __pydantic__self__,
*, *,
gift_id: str, gift_id: str,
user_id: Optional[int] = None, user_id: int | None = None,
chat_id: Optional[ChatIdUnion] = None, chat_id: ChatIdUnion | None = None,
pay_for_upgrade: Optional[bool] = None, pay_for_upgrade: bool | None = None,
text: Optional[str] = None, text: str | None = None,
text_parse_mode: Optional[str] = None, text_parse_mode: str | None = None,
text_entities: Optional[list[MessageEntity]] = None, text_entities: list[MessageEntity] | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -38,64 +38,62 @@ class SendInvoice(TelegramMethod[Message]):
"""Three-letter ISO 4217 currency code, see `more on currencies <https://core.telegram.org/bots/payments#supported-currencies>`_. Pass 'XTR' for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Three-letter ISO 4217 currency code, see `more on currencies <https://core.telegram.org/bots/payments#supported-currencies>`_. Pass 'XTR' for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
prices: list[LabeledPrice] prices: list[LabeledPrice]
"""Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
provider_token: Optional[str] = None provider_token: str | None = None
"""Payment provider token, obtained via `@BotFather <https://t.me/botfather>`_. Pass an empty string for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Payment provider token, obtained via `@BotFather <https://t.me/botfather>`_. Pass an empty string for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
max_tip_amount: Optional[int] = None max_tip_amount: int | None = None
"""The maximum accepted amount for tips in the *smallest units* of the currency (integer, **not** float/double). For example, for a maximum tip of :code:`US$ 1.45` pass :code:`max_tip_amount = 145`. See the *exp* parameter in `currencies.json <https://core.telegram.org/bots/payments/currencies.json>`_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """The maximum accepted amount for tips in the *smallest units* of the currency (integer, **not** float/double). For example, for a maximum tip of :code:`US$ 1.45` pass :code:`max_tip_amount = 145`. See the *exp* parameter in `currencies.json <https://core.telegram.org/bots/payments/currencies.json>`_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
suggested_tip_amounts: Optional[list[int]] = None suggested_tip_amounts: list[int] | None = None
"""A JSON-serialized array of suggested amounts of tips in the *smallest units* of the currency (integer, **not** float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed *max_tip_amount*.""" """A JSON-serialized array of suggested amounts of tips in the *smallest units* of the currency (integer, **not** float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed *max_tip_amount*."""
start_parameter: Optional[str] = None start_parameter: str | None = None
"""Unique deep-linking parameter. If left empty, **forwarded copies** of the sent message will have a *Pay* button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a *URL* button with a deep link to the bot (instead of a *Pay* button), with the value used as the start parameter""" """Unique deep-linking parameter. If left empty, **forwarded copies** of the sent message will have a *Pay* button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a *URL* button with a deep link to the bot (instead of a *Pay* button), with the value used as the start parameter"""
provider_data: Optional[str] = None provider_data: str | None = None
"""JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.""" """JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider."""
photo_url: Optional[str] = None photo_url: str | None = None
"""URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.""" """URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for."""
photo_size: Optional[int] = None photo_size: int | None = None
"""Photo size in bytes""" """Photo size in bytes"""
photo_width: Optional[int] = None photo_width: int | None = None
"""Photo width""" """Photo width"""
photo_height: Optional[int] = None photo_height: int | None = None
"""Photo height""" """Photo height"""
need_name: Optional[bool] = None need_name: bool | None = None
"""Pass :code:`True` if you require the user's full name to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Pass :code:`True` if you require the user's full name to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
need_phone_number: Optional[bool] = None need_phone_number: bool | None = None
"""Pass :code:`True` if you require the user's phone number to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Pass :code:`True` if you require the user's phone number to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
need_email: Optional[bool] = None need_email: bool | None = None
"""Pass :code:`True` if you require the user's email address to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Pass :code:`True` if you require the user's email address to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
need_shipping_address: Optional[bool] = None need_shipping_address: bool | None = None
"""Pass :code:`True` if you require the user's shipping address to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Pass :code:`True` if you require the user's shipping address to complete the order. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
send_phone_number_to_provider: Optional[bool] = None send_phone_number_to_provider: bool | None = None
"""Pass :code:`True` if the user's phone number should be sent to the provider. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Pass :code:`True` if the user's phone number should be sent to the provider. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
send_email_to_provider: Optional[bool] = None send_email_to_provider: bool | None = None
"""Pass :code:`True` if the user's email address should be sent to the provider. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Pass :code:`True` if the user's email address should be sent to the provider. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
is_flexible: Optional[bool] = None is_flexible: bool | None = None
"""Pass :code:`True` if the final price depends on the shipping method. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_.""" """Pass :code:`True` if the final price depends on the shipping method. Ignored for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: InlineKeyboardMarkup | None = None
"""A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. If empty, one 'Pay :code:`total price`' button will be shown. If not empty, the first button must be a Pay button.""" """A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_. If empty, one 'Pay :code:`total price`' button will be shown. If not empty, the first button must be a Pay button."""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -114,33 +112,33 @@ class SendInvoice(TelegramMethod[Message]):
payload: str, payload: str,
currency: str, currency: str,
prices: list[LabeledPrice], prices: list[LabeledPrice],
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
provider_token: Optional[str] = None, provider_token: str | None = None,
max_tip_amount: Optional[int] = None, max_tip_amount: int | None = None,
suggested_tip_amounts: Optional[list[int]] = None, suggested_tip_amounts: list[int] | None = None,
start_parameter: Optional[str] = None, start_parameter: str | None = None,
provider_data: Optional[str] = None, provider_data: str | None = None,
photo_url: Optional[str] = None, photo_url: str | None = None,
photo_size: Optional[int] = None, photo_size: int | None = None,
photo_width: Optional[int] = None, photo_width: int | None = None,
photo_height: Optional[int] = None, photo_height: int | None = None,
need_name: Optional[bool] = None, need_name: bool | None = None,
need_phone_number: Optional[bool] = None, need_phone_number: bool | None = None,
need_email: Optional[bool] = None, need_email: bool | None = None,
need_shipping_address: Optional[bool] = None, need_shipping_address: bool | None = None,
send_phone_number_to_provider: Optional[bool] = None, send_phone_number_to_provider: bool | None = None,
send_email_to_provider: Optional[bool] = None, send_email_to_provider: bool | None = None,
is_flexible: Optional[bool] = None, is_flexible: bool | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), protect_content: bool | Default | None = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
message_effect_id: Optional[str] = None, message_effect_id: str | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
reply_parameters: Optional[ReplyParameters] = None, reply_parameters: ReplyParameters | None = None,
reply_markup: Optional[InlineKeyboardMarkup] = None, reply_markup: InlineKeyboardMarkup | None = None,
allow_sending_without_reply: Optional[bool] = None, allow_sending_without_reply: bool | None = None,
reply_to_message_id: Optional[int] = None, reply_to_message_id: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -31,42 +31,40 @@ class SendLocation(TelegramMethod[Message]):
"""Latitude of the location""" """Latitude of the location"""
longitude: float longitude: float
"""Longitude of the location""" """Longitude of the location"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
horizontal_accuracy: Optional[float] = None horizontal_accuracy: float | None = None
"""The radius of uncertainty for the location, measured in meters; 0-1500""" """The radius of uncertainty for the location, measured in meters; 0-1500"""
live_period: Optional[int] = None live_period: int | None = None
"""Period in seconds during which the location will be updated (see `Live Locations <https://telegram.org/blog/live-locations>`_, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely.""" """Period in seconds during which the location will be updated (see `Live Locations <https://telegram.org/blog/live-locations>`_, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely."""
heading: Optional[int] = None heading: int | None = None
"""For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.""" """For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified."""
proximity_alert_radius: Optional[int] = None proximity_alert_radius: int | None = None
"""For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.""" """For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified."""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None reply_markup: ReplyMarkupUnion | None = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user""" """Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -82,22 +80,22 @@ class SendLocation(TelegramMethod[Message]):
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
latitude: float, latitude: float,
longitude: float, longitude: float,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
horizontal_accuracy: Optional[float] = None, horizontal_accuracy: float | None = None,
live_period: Optional[int] = None, live_period: int | None = None,
heading: Optional[int] = None, heading: int | None = None,
proximity_alert_radius: Optional[int] = None, proximity_alert_radius: int | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), protect_content: bool | Default | None = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
message_effect_id: Optional[str] = None, message_effect_id: str | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
reply_parameters: Optional[ReplyParameters] = None, reply_parameters: ReplyParameters | None = None,
reply_markup: Optional[ReplyMarkupUnion] = None, reply_markup: ReplyMarkupUnion | None = None,
allow_sending_without_reply: Optional[bool] = None, allow_sending_without_reply: bool | None = None,
reply_to_message_id: Optional[int] = None, reply_to_message_id: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -23,30 +23,28 @@ class SendMediaGroup(TelegramMethod[list[Message]]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
media: list[MediaUnion] media: list[MediaUnion]
"""A JSON-serialized array describing messages to be sent, must include 2-10 items""" """A JSON-serialized array describing messages to be sent, must include 2-10 items"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat""" """Identifier of the direct messages topic to which the messages will be sent; required if the messages are sent to a direct messages chat"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends messages `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends messages `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent messages from forwarding and saving""" """Protects the contents of the sent messages from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the messages are a reply, ID of the original message """If the messages are a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -61,16 +59,16 @@ class SendMediaGroup(TelegramMethod[list[Message]]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
media: list[MediaUnion], media: list[MediaUnion],
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), protect_content: bool | Default | None = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
message_effect_id: Optional[str] = None, message_effect_id: str | None = None,
reply_parameters: Optional[ReplyParameters] = None, reply_parameters: ReplyParameters | None = None,
allow_sending_without_reply: Optional[bool] = None, allow_sending_without_reply: bool | None = None,
reply_to_message_id: Optional[int] = None, reply_to_message_id: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -31,47 +31,45 @@ class SendMessage(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
text: str text: str
"""Text of the message to be sent, 1-4096 characters after entities parsing""" """Text of the message to be sent, 1-4096 characters after entities parsing"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode") parse_mode: str | Default | None = Default("parse_mode")
"""Mode for parsing entities in the message text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.""" """Mode for parsing entities in the message text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
entities: Optional[list[MessageEntity]] = None entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*""" """A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*"""
link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default("link_preview") link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview")
"""Link preview generation options for the message""" """Link preview generation options for the message"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None reply_markup: ReplyMarkupUnion | None = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user""" """Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
disable_web_page_preview: Optional[Union[bool, Default]] = Field( disable_web_page_preview: bool | Default | None = Field(
Default("link_preview_is_disabled"), json_schema_extra={"deprecated": True} Default("link_preview_is_disabled"), json_schema_extra={"deprecated": True}
) )
"""Disables link previews for links in this message """Disables link previews for links in this message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -86,26 +84,22 @@ class SendMessage(TelegramMethod[Message]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
text: str, text: str,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), parse_mode: str | Default | None = Default("parse_mode"),
entities: Optional[list[MessageEntity]] = None, entities: list[MessageEntity] | None = None,
link_preview_options: Optional[Union[LinkPreviewOptions, Default]] = Default( link_preview_options: LinkPreviewOptions | Default | None = Default("link_preview"),
"link_preview" disable_notification: bool | None = None,
), protect_content: bool | Default | None = Default("protect_content"),
disable_notification: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), message_effect_id: str | None = None,
allow_paid_broadcast: Optional[bool] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
message_effect_id: Optional[str] = None, reply_parameters: ReplyParameters | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, reply_markup: ReplyMarkupUnion | None = None,
reply_parameters: Optional[ReplyParameters] = None, allow_sending_without_reply: bool | None = None,
reply_markup: Optional[ReplyMarkupUnion] = None, disable_web_page_preview: bool | Default | None = Default("link_preview_is_disabled"),
allow_sending_without_reply: Optional[bool] = None, reply_to_message_id: int | None = None,
disable_web_page_preview: Optional[Union[bool, Default]] = Default(
"link_preview_is_disabled"
),
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import MessageEntity from ..types import MessageEntity
from .base import TelegramMethod from .base import TelegramMethod
@ -22,11 +22,11 @@ class SendMessageDraft(TelegramMethod[bool]):
"""Unique identifier of the message draft; must be non-zero. Changes of drafts with the same identifier are animated""" """Unique identifier of the message draft; must be non-zero. Changes of drafts with the same identifier are animated"""
text: str text: str
"""Text of the message to be sent, 1-4096 characters after entities parsing""" """Text of the message to be sent, 1-4096 characters after entities parsing"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread""" """Unique identifier for the target message thread"""
parse_mode: Optional[str] = None parse_mode: str | None = None
"""Mode for parsing entities in the message text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.""" """Mode for parsing entities in the message text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
entities: Optional[list[MessageEntity]] = None entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*""" """A JSON-serialized list of special entities that appear in message text, which can be specified instead of *parse_mode*"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -39,9 +39,9 @@ class SendMessageDraft(TelegramMethod[bool]):
chat_id: int, chat_id: int,
draft_id: int, draft_id: int,
text: str, text: str,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
parse_mode: Optional[str] = None, parse_mode: str | None = None,
entities: Optional[list[MessageEntity]] = None, entities: list[MessageEntity] | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ( from ..types import (
ChatIdUnion, ChatIdUnion,
@ -30,33 +30,33 @@ class SendPaidMedia(TelegramMethod[Message]):
"""The number of Telegram Stars that must be paid to buy access to the media; 1-25000""" """The number of Telegram Stars that must be paid to buy access to the media; 1-25000"""
media: list[InputPaidMediaUnion] media: list[InputPaidMediaUnion]
"""A JSON-serialized array describing the media to be sent; up to 10 items""" """A JSON-serialized array describing the media to be sent; up to 10 items"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
payload: Optional[str] = None payload: str | None = None
"""Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.""" """Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes."""
caption: Optional[str] = None caption: str | None = None
"""Media caption, 0-1024 characters after entities parsing""" """Media caption, 0-1024 characters after entities parsing"""
parse_mode: Optional[str] = None parse_mode: str | None = None
"""Mode for parsing entities in the media caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.""" """Mode for parsing entities in the media caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[list[MessageEntity]] = None caption_entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
show_caption_above_media: Optional[bool] = None show_caption_above_media: bool | None = None
"""Pass :code:`True`, if the caption must be shown above the message media""" """Pass :code:`True`, if the caption must be shown above the message media"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[bool] = None protect_content: bool | None = None
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None reply_markup: ReplyMarkupUnion | None = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user""" """Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -69,20 +69,20 @@ class SendPaidMedia(TelegramMethod[Message]):
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
star_count: int, star_count: int,
media: list[InputPaidMediaUnion], media: list[InputPaidMediaUnion],
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
payload: Optional[str] = None, payload: str | None = None,
caption: Optional[str] = None, caption: str | None = None,
parse_mode: Optional[str] = None, parse_mode: str | None = None,
caption_entities: Optional[list[MessageEntity]] = None, caption_entities: list[MessageEntity] | None = None,
show_caption_above_media: Optional[bool] = None, show_caption_above_media: bool | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[bool] = None, protect_content: bool | None = None,
allow_paid_broadcast: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
reply_parameters: Optional[ReplyParameters] = None, reply_parameters: ReplyParameters | None = None,
reply_markup: Optional[ReplyMarkupUnion] = None, reply_markup: ReplyMarkupUnion | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -31,44 +31,42 @@ class SendPhoto(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
photo: InputFileUnion photo: InputFileUnion
"""Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. :ref:`More information on Sending Files » <sending-files>`""" """Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
caption: Optional[str] = None caption: str | None = None
"""Photo caption (may also be used when resending photos by *file_id*), 0-1024 characters after entities parsing""" """Photo caption (may also be used when resending photos by *file_id*), 0-1024 characters after entities parsing"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode") parse_mode: str | Default | None = Default("parse_mode")
"""Mode for parsing entities in the photo caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.""" """Mode for parsing entities in the photo caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[list[MessageEntity]] = None caption_entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") show_caption_above_media: bool | Default | None = Default("show_caption_above_media")
"""Pass :code:`True`, if the caption must be shown above the message media""" """Pass :code:`True`, if the caption must be shown above the message media"""
has_spoiler: Optional[bool] = None has_spoiler: bool | None = None
"""Pass :code:`True` if the photo needs to be covered with a spoiler animation""" """Pass :code:`True` if the photo needs to be covered with a spoiler animation"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None reply_markup: ReplyMarkupUnion | None = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user""" """Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -83,25 +81,23 @@ class SendPhoto(TelegramMethod[Message]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
photo: InputFileUnion, photo: InputFileUnion,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
caption: Optional[str] = None, caption: str | None = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), parse_mode: str | Default | None = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None, caption_entities: list[MessageEntity] | None = None,
show_caption_above_media: Optional[Union[bool, Default]] = Default( show_caption_above_media: bool | Default | None = Default("show_caption_above_media"),
"show_caption_above_media" has_spoiler: bool | None = None,
), disable_notification: bool | None = None,
has_spoiler: Optional[bool] = None, protect_content: bool | Default | None = Default("protect_content"),
disable_notification: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), message_effect_id: str | None = None,
allow_paid_broadcast: Optional[bool] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
message_effect_id: Optional[str] = None, reply_parameters: ReplyParameters | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, reply_markup: ReplyMarkupUnion | None = None,
reply_parameters: Optional[ReplyParameters] = None, allow_sending_without_reply: bool | None = None,
reply_markup: Optional[ReplyMarkupUnion] = None, reply_to_message_id: int | None = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -33,54 +33,52 @@ class SendPoll(TelegramMethod[Message]):
"""Poll question, 1-300 characters""" """Poll question, 1-300 characters"""
options: list[InputPollOptionUnion] options: list[InputPollOptionUnion]
"""A JSON-serialized list of 2-12 answer options""" """A JSON-serialized list of 2-12 answer options"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
question_parse_mode: Optional[Union[str, Default]] = Default("parse_mode") question_parse_mode: str | Default | None = Default("parse_mode")
"""Mode for parsing entities in the question. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Currently, only custom emoji entities are allowed""" """Mode for parsing entities in the question. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Currently, only custom emoji entities are allowed"""
question_entities: Optional[list[MessageEntity]] = None question_entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in the poll question. It can be specified instead of *question_parse_mode*""" """A JSON-serialized list of special entities that appear in the poll question. It can be specified instead of *question_parse_mode*"""
is_anonymous: Optional[bool] = None is_anonymous: bool | None = None
""":code:`True`, if the poll needs to be anonymous, defaults to :code:`True`""" """:code:`True`, if the poll needs to be anonymous, defaults to :code:`True`"""
type: Optional[str] = None type: str | None = None
"""Poll type, 'quiz' or 'regular', defaults to 'regular'""" """Poll type, 'quiz' or 'regular', defaults to 'regular'"""
allows_multiple_answers: Optional[bool] = None allows_multiple_answers: bool | None = None
""":code:`True`, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to :code:`False`""" """:code:`True`, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to :code:`False`"""
correct_option_id: Optional[int] = None correct_option_id: int | None = None
"""0-based identifier of the correct answer option, required for polls in quiz mode""" """0-based identifier of the correct answer option, required for polls in quiz mode"""
explanation: Optional[str] = None explanation: str | None = None
"""Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing""" """Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing"""
explanation_parse_mode: Optional[Union[str, Default]] = Default("parse_mode") explanation_parse_mode: str | Default | None = Default("parse_mode")
"""Mode for parsing entities in the explanation. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.""" """Mode for parsing entities in the explanation. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
explanation_entities: Optional[list[MessageEntity]] = None explanation_entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in the poll explanation. It can be specified instead of *explanation_parse_mode*""" """A JSON-serialized list of special entities that appear in the poll explanation. It can be specified instead of *explanation_parse_mode*"""
open_period: Optional[int] = None open_period: int | None = None
"""Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with *close_date*.""" """Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with *close_date*."""
close_date: Optional[DateTimeUnion] = None close_date: DateTimeUnion | None = None
"""Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with *open_period*.""" """Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with *open_period*."""
is_closed: Optional[bool] = None is_closed: bool | None = None
"""Pass :code:`True` if the poll needs to be immediately closed. This can be useful for poll preview.""" """Pass :code:`True` if the poll needs to be immediately closed. This can be useful for poll preview."""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None reply_markup: ReplyMarkupUnion | None = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user""" """Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -96,28 +94,28 @@ class SendPoll(TelegramMethod[Message]):
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
question: str, question: str,
options: list[InputPollOptionUnion], options: list[InputPollOptionUnion],
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
question_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), question_parse_mode: str | Default | None = Default("parse_mode"),
question_entities: Optional[list[MessageEntity]] = None, question_entities: list[MessageEntity] | None = None,
is_anonymous: Optional[bool] = None, is_anonymous: bool | None = None,
type: Optional[str] = None, type: str | None = None,
allows_multiple_answers: Optional[bool] = None, allows_multiple_answers: bool | None = None,
correct_option_id: Optional[int] = None, correct_option_id: int | None = None,
explanation: Optional[str] = None, explanation: str | None = None,
explanation_parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), explanation_parse_mode: str | Default | None = Default("parse_mode"),
explanation_entities: Optional[list[MessageEntity]] = None, explanation_entities: list[MessageEntity] | None = None,
open_period: Optional[int] = None, open_period: int | None = None,
close_date: Optional[DateTimeUnion] = None, close_date: DateTimeUnion | None = None,
is_closed: Optional[bool] = None, is_closed: bool | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), protect_content: bool | Default | None = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
message_effect_id: Optional[str] = None, message_effect_id: str | None = None,
reply_parameters: Optional[ReplyParameters] = None, reply_parameters: ReplyParameters | None = None,
reply_markup: Optional[ReplyMarkupUnion] = None, reply_markup: ReplyMarkupUnion | None = None,
allow_sending_without_reply: Optional[bool] = None, allow_sending_without_reply: bool | None = None,
reply_to_message_id: Optional[int] = None, reply_to_message_id: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -30,36 +30,34 @@ class SendSticker(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
sticker: InputFileUnion sticker: InputFileUnion
"""Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`. Video and animated stickers can't be sent via an HTTP URL.""" """Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`. Video and animated stickers can't be sent via an HTTP URL."""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
emoji: Optional[str] = None emoji: str | None = None
"""Emoji associated with the sticker; only for just uploaded stickers""" """Emoji associated with the sticker; only for just uploaded stickers"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None reply_markup: ReplyMarkupUnion | None = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user""" """Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -74,19 +72,19 @@ class SendSticker(TelegramMethod[Message]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
sticker: InputFileUnion, sticker: InputFileUnion,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
emoji: Optional[str] = None, emoji: str | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), protect_content: bool | Default | None = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
message_effect_id: Optional[str] = None, message_effect_id: str | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
reply_parameters: Optional[ReplyParameters] = None, reply_parameters: ReplyParameters | None = None,
reply_markup: Optional[ReplyMarkupUnion] = None, reply_markup: ReplyMarkupUnion | None = None,
allow_sending_without_reply: Optional[bool] = None, allow_sending_without_reply: bool | None = None,
reply_to_message_id: Optional[int] = None, reply_to_message_id: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -35,42 +35,40 @@ class SendVenue(TelegramMethod[Message]):
"""Name of the venue""" """Name of the venue"""
address: str address: str
"""Address of the venue""" """Address of the venue"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
foursquare_id: Optional[str] = None foursquare_id: str | None = None
"""Foursquare identifier of the venue""" """Foursquare identifier of the venue"""
foursquare_type: Optional[str] = None foursquare_type: str | None = None
"""Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.)""" """Foursquare type of the venue, if known. (For example, 'arts_entertainment/default', 'arts_entertainment/aquarium' or 'food/icecream'.)"""
google_place_id: Optional[str] = None google_place_id: str | None = None
"""Google Places identifier of the venue""" """Google Places identifier of the venue"""
google_place_type: Optional[str] = None google_place_type: str | None = None
"""Google Places type of the venue. (See `supported types <https://developers.google.com/places/web-service/supported_types>`_.)""" """Google Places type of the venue. (See `supported types <https://developers.google.com/places/web-service/supported_types>`_.)"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None reply_markup: ReplyMarkupUnion | None = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user""" """Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -88,22 +86,22 @@ class SendVenue(TelegramMethod[Message]):
longitude: float, longitude: float,
title: str, title: str,
address: str, address: str,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
foursquare_id: Optional[str] = None, foursquare_id: str | None = None,
foursquare_type: Optional[str] = None, foursquare_type: str | None = None,
google_place_id: Optional[str] = None, google_place_id: str | None = None,
google_place_type: Optional[str] = None, google_place_type: str | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), protect_content: bool | Default | None = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
message_effect_id: Optional[str] = None, message_effect_id: str | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
reply_parameters: Optional[ReplyParameters] = None, reply_parameters: ReplyParameters | None = None,
reply_markup: Optional[ReplyMarkupUnion] = None, reply_markup: ReplyMarkupUnion | None = None,
allow_sending_without_reply: Optional[bool] = None, allow_sending_without_reply: bool | None = None,
reply_to_message_id: Optional[int] = None, reply_to_message_id: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -33,58 +33,56 @@ class SendVideo(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
video: InputFileUnion video: InputFileUnion
"""Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`""" """Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
duration: Optional[int] = None duration: int | None = None
"""Duration of sent video in seconds""" """Duration of sent video in seconds"""
width: Optional[int] = None width: int | None = None
"""Video width""" """Video width"""
height: Optional[int] = None height: int | None = None
"""Video height""" """Video height"""
thumbnail: Optional[InputFile] = None thumbnail: InputFile | None = None
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`""" """Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
cover: Optional[InputFileUnion] = None cover: InputFileUnion | None = None
"""Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. :ref:`More information on Sending Files » <sending-files>`""" """Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. :ref:`More information on Sending Files » <sending-files>`"""
start_timestamp: Optional[DateTimeUnion] = None start_timestamp: DateTimeUnion | None = None
"""Start timestamp for the video in the message""" """Start timestamp for the video in the message"""
caption: Optional[str] = None caption: str | None = None
"""Video caption (may also be used when resending videos by *file_id*), 0-1024 characters after entities parsing""" """Video caption (may also be used when resending videos by *file_id*), 0-1024 characters after entities parsing"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode") parse_mode: str | Default | None = Default("parse_mode")
"""Mode for parsing entities in the video caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.""" """Mode for parsing entities in the video caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[list[MessageEntity]] = None caption_entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
show_caption_above_media: Optional[Union[bool, Default]] = Default("show_caption_above_media") show_caption_above_media: bool | Default | None = Default("show_caption_above_media")
"""Pass :code:`True`, if the caption must be shown above the message media""" """Pass :code:`True`, if the caption must be shown above the message media"""
has_spoiler: Optional[bool] = None has_spoiler: bool | None = None
"""Pass :code:`True` if the video needs to be covered with a spoiler animation""" """Pass :code:`True` if the video needs to be covered with a spoiler animation"""
supports_streaming: Optional[bool] = None supports_streaming: bool | None = None
"""Pass :code:`True` if the uploaded video is suitable for streaming""" """Pass :code:`True` if the uploaded video is suitable for streaming"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None reply_markup: ReplyMarkupUnion | None = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user""" """Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -99,32 +97,30 @@ class SendVideo(TelegramMethod[Message]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
video: InputFileUnion, video: InputFileUnion,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
duration: Optional[int] = None, duration: int | None = None,
width: Optional[int] = None, width: int | None = None,
height: Optional[int] = None, height: int | None = None,
thumbnail: Optional[InputFile] = None, thumbnail: InputFile | None = None,
cover: Optional[InputFileUnion] = None, cover: InputFileUnion | None = None,
start_timestamp: Optional[DateTimeUnion] = None, start_timestamp: DateTimeUnion | None = None,
caption: Optional[str] = None, caption: str | None = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), parse_mode: str | Default | None = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None, caption_entities: list[MessageEntity] | None = None,
show_caption_above_media: Optional[Union[bool, Default]] = Default( show_caption_above_media: bool | Default | None = Default("show_caption_above_media"),
"show_caption_above_media" has_spoiler: bool | None = None,
), supports_streaming: bool | None = None,
has_spoiler: Optional[bool] = None, disable_notification: bool | None = None,
supports_streaming: Optional[bool] = None, protect_content: bool | Default | None = Default("protect_content"),
disable_notification: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), message_effect_id: str | None = None,
allow_paid_broadcast: Optional[bool] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
message_effect_id: Optional[str] = None, reply_parameters: ReplyParameters | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, reply_markup: ReplyMarkupUnion | None = None,
reply_parameters: Optional[ReplyParameters] = None, allow_sending_without_reply: bool | None = None,
reply_markup: Optional[ReplyMarkupUnion] = None, reply_to_message_id: int | None = None,
allow_sending_without_reply: Optional[bool] = None,
reply_to_message_id: Optional[int] = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -31,40 +31,38 @@ class SendVideoNote(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
video_note: InputFileUnion video_note: InputFileUnion
"""Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`. Sending video notes by a URL is currently unsupported""" """Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`. Sending video notes by a URL is currently unsupported"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
duration: Optional[int] = None duration: int | None = None
"""Duration of sent video in seconds""" """Duration of sent video in seconds"""
length: Optional[int] = None length: int | None = None
"""Video width and height, i.e. diameter of the video message""" """Video width and height, i.e. diameter of the video message"""
thumbnail: Optional[InputFile] = None thumbnail: InputFile | None = None
"""Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`""" """Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. :ref:`More information on Sending Files » <sending-files>`"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None reply_markup: ReplyMarkupUnion | None = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user""" """Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -79,21 +77,21 @@ class SendVideoNote(TelegramMethod[Message]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
video_note: InputFileUnion, video_note: InputFileUnion,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
duration: Optional[int] = None, duration: int | None = None,
length: Optional[int] = None, length: int | None = None,
thumbnail: Optional[InputFile] = None, thumbnail: InputFile | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), protect_content: bool | Default | None = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
message_effect_id: Optional[str] = None, message_effect_id: str | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
reply_parameters: Optional[ReplyParameters] = None, reply_parameters: ReplyParameters | None = None,
reply_markup: Optional[ReplyMarkupUnion] = None, reply_markup: ReplyMarkupUnion | None = None,
allow_sending_without_reply: Optional[bool] = None, allow_sending_without_reply: bool | None = None,
reply_to_message_id: Optional[int] = None, reply_to_message_id: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from pydantic import Field from pydantic import Field
@ -31,42 +31,40 @@ class SendVoice(TelegramMethod[Message]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
voice: InputFileUnion voice: InputFileUnion
"""Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`""" """Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`"""
business_connection_id: Optional[str] = None business_connection_id: str | None = None
"""Unique identifier of the business connection on behalf of which the message will be sent""" """Unique identifier of the business connection on behalf of which the message will be sent"""
message_thread_id: Optional[int] = None message_thread_id: int | None = None
"""Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only""" """Unique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only"""
direct_messages_topic_id: Optional[int] = None direct_messages_topic_id: int | None = None
"""Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat""" """Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat"""
caption: Optional[str] = None caption: str | None = None
"""Voice message caption, 0-1024 characters after entities parsing""" """Voice message caption, 0-1024 characters after entities parsing"""
parse_mode: Optional[Union[str, Default]] = Default("parse_mode") parse_mode: str | Default | None = Default("parse_mode")
"""Mode for parsing entities in the voice message caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details.""" """Mode for parsing entities in the voice message caption. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details."""
caption_entities: Optional[list[MessageEntity]] = None caption_entities: list[MessageEntity] | None = None
"""A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*""" """A JSON-serialized list of special entities that appear in the caption, which can be specified instead of *parse_mode*"""
duration: Optional[int] = None duration: int | None = None
"""Duration of the voice message in seconds""" """Duration of the voice message in seconds"""
disable_notification: Optional[bool] = None disable_notification: bool | None = None
"""Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound.""" """Sends the message `silently <https://telegram.org/blog/channels-2-0#silent-messages>`_. Users will receive a notification with no sound."""
protect_content: Optional[Union[bool, Default]] = Default("protect_content") protect_content: bool | Default | None = Default("protect_content")
"""Protects the contents of the sent message from forwarding and saving""" """Protects the contents of the sent message from forwarding and saving"""
allow_paid_broadcast: Optional[bool] = None allow_paid_broadcast: bool | None = None
"""Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance""" """Pass :code:`True` to allow up to 1000 messages per second, ignoring `broadcasting limits <https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once>`_ for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance"""
message_effect_id: Optional[str] = None message_effect_id: str | None = None
"""Unique identifier of the message effect to be added to the message; for private chats only""" """Unique identifier of the message effect to be added to the message; for private chats only"""
suggested_post_parameters: Optional[SuggestedPostParameters] = None suggested_post_parameters: SuggestedPostParameters | None = None
"""A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.""" """A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined."""
reply_parameters: Optional[ReplyParameters] = None reply_parameters: ReplyParameters | None = None
"""Description of the message to reply to""" """Description of the message to reply to"""
reply_markup: Optional[ReplyMarkupUnion] = None reply_markup: ReplyMarkupUnion | None = None
"""Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user""" """Additional interface options. A JSON-serialized object for an `inline keyboard <https://core.telegram.org/bots/features#inline-keyboards>`_, `custom reply keyboard <https://core.telegram.org/bots/features#keyboards>`_, instructions to remove a reply keyboard or to force a reply from the user"""
allow_sending_without_reply: Optional[bool] = Field( allow_sending_without_reply: bool | None = Field(None, json_schema_extra={"deprecated": True})
None, json_schema_extra={"deprecated": True}
)
"""Pass :code:`True` if the message should be sent even if the specified replied-to message is not found """Pass :code:`True` if the message should be sent even if the specified replied-to message is not found
.. deprecated:: API:7.0 .. deprecated:: API:7.0
https://core.telegram.org/bots/api-changelog#december-29-2023""" https://core.telegram.org/bots/api-changelog#december-29-2023"""
reply_to_message_id: Optional[int] = Field(None, json_schema_extra={"deprecated": True}) reply_to_message_id: int | None = Field(None, json_schema_extra={"deprecated": True})
"""If the message is a reply, ID of the original message """If the message is a reply, ID of the original message
.. deprecated:: API:7.0 .. deprecated:: API:7.0
@ -81,22 +79,22 @@ class SendVoice(TelegramMethod[Message]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
voice: InputFileUnion, voice: InputFileUnion,
business_connection_id: Optional[str] = None, business_connection_id: str | None = None,
message_thread_id: Optional[int] = None, message_thread_id: int | None = None,
direct_messages_topic_id: Optional[int] = None, direct_messages_topic_id: int | None = None,
caption: Optional[str] = None, caption: str | None = None,
parse_mode: Optional[Union[str, Default]] = Default("parse_mode"), parse_mode: str | Default | None = Default("parse_mode"),
caption_entities: Optional[list[MessageEntity]] = None, caption_entities: list[MessageEntity] | None = None,
duration: Optional[int] = None, duration: int | None = None,
disable_notification: Optional[bool] = None, disable_notification: bool | None = None,
protect_content: Optional[Union[bool, Default]] = Default("protect_content"), protect_content: bool | Default | None = Default("protect_content"),
allow_paid_broadcast: Optional[bool] = None, allow_paid_broadcast: bool | None = None,
message_effect_id: Optional[str] = None, message_effect_id: str | None = None,
suggested_post_parameters: Optional[SuggestedPostParameters] = None, suggested_post_parameters: SuggestedPostParameters | None = None,
reply_parameters: Optional[ReplyParameters] = None, reply_parameters: ReplyParameters | None = None,
reply_markup: Optional[ReplyMarkupUnion] = None, reply_markup: ReplyMarkupUnion | None = None,
allow_sending_without_reply: Optional[bool] = None, allow_sending_without_reply: bool | None = None,
reply_to_message_id: Optional[int] = None, reply_to_message_id: int | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from .base import TelegramMethod from .base import TelegramMethod
@ -17,7 +17,7 @@ class SetBusinessAccountBio(TelegramMethod[bool]):
business_connection_id: str business_connection_id: str
"""Unique identifier of the business connection""" """Unique identifier of the business connection"""
bio: Optional[str] = None bio: str | None = None
"""The new value of the bio for the business account; 0-140 characters""" """The new value of the bio for the business account; 0-140 characters"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -28,7 +28,7 @@ class SetBusinessAccountBio(TelegramMethod[bool]):
__pydantic__self__, __pydantic__self__,
*, *,
business_connection_id: str, business_connection_id: str,
bio: Optional[str] = None, bio: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from .base import TelegramMethod from .base import TelegramMethod
@ -19,7 +19,7 @@ class SetBusinessAccountName(TelegramMethod[bool]):
"""Unique identifier of the business connection""" """Unique identifier of the business connection"""
first_name: str first_name: str
"""The new value of the first name for the business account; 1-64 characters""" """The new value of the first name for the business account; 1-64 characters"""
last_name: Optional[str] = None last_name: str | None = None
"""The new value of the last name for the business account; 0-64 characters""" """The new value of the last name for the business account; 0-64 characters"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -31,7 +31,7 @@ class SetBusinessAccountName(TelegramMethod[bool]):
*, *,
business_connection_id: str, business_connection_id: str,
first_name: str, first_name: str,
last_name: Optional[str] = None, last_name: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import InputProfilePhotoUnion from ..types import InputProfilePhotoUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -20,7 +20,7 @@ class SetBusinessAccountProfilePhoto(TelegramMethod[bool]):
"""Unique identifier of the business connection""" """Unique identifier of the business connection"""
photo: InputProfilePhotoUnion photo: InputProfilePhotoUnion
"""The new profile photo to set""" """The new profile photo to set"""
is_public: Optional[bool] = None is_public: bool | None = None
"""Pass :code:`True` to set the public photo, which will be visible even if the main photo is hidden by the business account's privacy settings. An account can have only one public photo.""" """Pass :code:`True` to set the public photo, which will be visible even if the main photo is hidden by the business account's privacy settings. An account can have only one public photo."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -32,7 +32,7 @@ class SetBusinessAccountProfilePhoto(TelegramMethod[bool]):
*, *,
business_connection_id: str, business_connection_id: str,
photo: InputProfilePhotoUnion, photo: InputProfilePhotoUnion,
is_public: Optional[bool] = None, is_public: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from .base import TelegramMethod from .base import TelegramMethod
@ -17,7 +17,7 @@ class SetBusinessAccountUsername(TelegramMethod[bool]):
business_connection_id: str business_connection_id: str
"""Unique identifier of the business connection""" """Unique identifier of the business connection"""
username: Optional[str] = None username: str | None = None
"""The new value of the username for the business account; 0-32 characters""" """The new value of the username for the business account; 0-32 characters"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -28,7 +28,7 @@ class SetBusinessAccountUsername(TelegramMethod[bool]):
__pydantic__self__, __pydantic__self__,
*, *,
business_connection_id: str, business_connection_id: str,
username: Optional[str] = None, username: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion from ..types import ChatIdUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -18,7 +18,7 @@ class SetChatDescription(TelegramMethod[bool]):
chat_id: ChatIdUnion chat_id: ChatIdUnion
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
description: Optional[str] = None description: str | None = None
"""New chat description, 0-255 characters""" """New chat description, 0-255 characters"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -29,7 +29,7 @@ class SetChatDescription(TelegramMethod[bool]):
__pydantic__self__, __pydantic__self__,
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
description: Optional[str] = None, description: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import MenuButtonUnion from ..types import MenuButtonUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -16,9 +16,9 @@ class SetChatMenuButton(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
__api_method__ = "setChatMenuButton" __api_method__ = "setChatMenuButton"
chat_id: Optional[int] = None chat_id: int | None = None
"""Unique identifier for the target private chat. If not specified, default bot's menu button will be changed""" """Unique identifier for the target private chat. If not specified, default bot's menu button will be changed"""
menu_button: Optional[MenuButtonUnion] = None menu_button: MenuButtonUnion | None = None
"""A JSON-serialized object for the bot's new menu button. Defaults to :class:`aiogram.types.menu_button_default.MenuButtonDefault`""" """A JSON-serialized object for the bot's new menu button. Defaults to :class:`aiogram.types.menu_button_default.MenuButtonDefault`"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -28,8 +28,8 @@ class SetChatMenuButton(TelegramMethod[bool]):
def __init__( def __init__(
__pydantic__self__, __pydantic__self__,
*, *,
chat_id: Optional[int] = None, chat_id: int | None = None,
menu_button: Optional[MenuButtonUnion] = None, menu_button: MenuButtonUnion | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, ChatPermissions from ..types import ChatIdUnion, ChatPermissions
from .base import TelegramMethod from .base import TelegramMethod
@ -20,7 +20,7 @@ class SetChatPermissions(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)""" """Unique identifier for the target chat or username of the target supergroup (in the format :code:`@supergroupusername`)"""
permissions: ChatPermissions permissions: ChatPermissions
"""A JSON-serialized object for new default chat permissions""" """A JSON-serialized object for new default chat permissions"""
use_independent_chat_permissions: Optional[bool] = None use_independent_chat_permissions: bool | None = None
"""Pass :code:`True` if chat permissions are set independently. Otherwise, the *can_send_other_messages* and *can_add_web_page_previews* permissions will imply the *can_send_messages*, *can_send_audios*, *can_send_documents*, *can_send_photos*, *can_send_videos*, *can_send_video_notes*, and *can_send_voice_notes* permissions; the *can_send_polls* permission will imply the *can_send_messages* permission.""" """Pass :code:`True` if chat permissions are set independently. Otherwise, the *can_send_other_messages* and *can_add_web_page_previews* permissions will imply the *can_send_messages*, *can_send_audios*, *can_send_documents*, *can_send_photos*, *can_send_videos*, *can_send_video_notes*, and *can_send_voice_notes* permissions; the *can_send_polls* permission will imply the *can_send_messages* permission."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -32,7 +32,7 @@ class SetChatPermissions(TelegramMethod[bool]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
permissions: ChatPermissions, permissions: ChatPermissions,
use_independent_chat_permissions: Optional[bool] = None, use_independent_chat_permissions: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from .base import TelegramMethod from .base import TelegramMethod
@ -17,7 +17,7 @@ class SetCustomEmojiStickerSetThumbnail(TelegramMethod[bool]):
name: str name: str
"""Sticker set name""" """Sticker set name"""
custom_emoji_id: Optional[str] = None custom_emoji_id: str | None = None
"""Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.""" """Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -28,7 +28,7 @@ class SetCustomEmojiStickerSetThumbnail(TelegramMethod[bool]):
__pydantic__self__, __pydantic__self__,
*, *,
name: str, name: str,
custom_emoji_id: Optional[str] = None, custom_emoji_id: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,34 +1,34 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union from typing import TYPE_CHECKING, Any
from ..types import Message from ..types import Message
from .base import TelegramMethod from .base import TelegramMethod
class SetGameScore(TelegramMethod[Union[Message, bool]]): class SetGameScore(TelegramMethod[Message | bool]):
""" """
Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Returns an error, if the new score is not greater than the user's current score in the chat and *force* is :code:`False`. Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the :class:`aiogram.types.message.Message` is returned, otherwise :code:`True` is returned. Returns an error, if the new score is not greater than the user's current score in the chat and *force* is :code:`False`.
Source: https://core.telegram.org/bots/api#setgamescore Source: https://core.telegram.org/bots/api#setgamescore
""" """
__returning__ = Union[Message, bool] __returning__ = Message | bool
__api_method__ = "setGameScore" __api_method__ = "setGameScore"
user_id: int user_id: int
"""User identifier""" """User identifier"""
score: int score: int
"""New score, must be non-negative""" """New score, must be non-negative"""
force: Optional[bool] = None force: bool | None = None
"""Pass :code:`True` if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters""" """Pass :code:`True` if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters"""
disable_edit_message: Optional[bool] = None disable_edit_message: bool | None = None
"""Pass :code:`True` if the game message should not be automatically edited to include the current scoreboard""" """Pass :code:`True` if the game message should not be automatically edited to include the current scoreboard"""
chat_id: Optional[int] = None chat_id: int | None = None
"""Required if *inline_message_id* is not specified. Unique identifier for the target chat""" """Required if *inline_message_id* is not specified. Unique identifier for the target chat"""
message_id: Optional[int] = None message_id: int | None = None
"""Required if *inline_message_id* is not specified. Identifier of the sent message""" """Required if *inline_message_id* is not specified. Identifier of the sent message"""
inline_message_id: Optional[str] = None inline_message_id: str | None = None
"""Required if *chat_id* and *message_id* are not specified. Identifier of the inline message""" """Required if *chat_id* and *message_id* are not specified. Identifier of the inline message"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -40,11 +40,11 @@ class SetGameScore(TelegramMethod[Union[Message, bool]]):
*, *,
user_id: int, user_id: int,
score: int, score: int,
force: Optional[bool] = None, force: bool | None = None,
disable_edit_message: Optional[bool] = None, disable_edit_message: bool | None = None,
chat_id: Optional[int] = None, chat_id: int | None = None,
message_id: Optional[int] = None, message_id: int | None = None,
inline_message_id: Optional[str] = None, inline_message_id: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatIdUnion, ReactionTypeUnion from ..types import ChatIdUnion, ReactionTypeUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -18,9 +18,9 @@ class SetMessageReaction(TelegramMethod[bool]):
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)""" """Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
message_id: int message_id: int
"""Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.""" """Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead."""
reaction: Optional[list[ReactionTypeUnion]] = None reaction: list[ReactionTypeUnion] | None = None
"""A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots.""" """A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots."""
is_big: Optional[bool] = None is_big: bool | None = None
"""Pass :code:`True` to set the reaction with a big animation""" """Pass :code:`True` to set the reaction with a big animation"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -32,8 +32,8 @@ class SetMessageReaction(TelegramMethod[bool]):
*, *,
chat_id: ChatIdUnion, chat_id: ChatIdUnion,
message_id: int, message_id: int,
reaction: Optional[list[ReactionTypeUnion]] = None, reaction: list[ReactionTypeUnion] | None = None,
is_big: Optional[bool] = None, is_big: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import BotCommand, BotCommandScopeUnion from ..types import BotCommand, BotCommandScopeUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -18,9 +18,9 @@ class SetMyCommands(TelegramMethod[bool]):
commands: list[BotCommand] commands: list[BotCommand]
"""A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified.""" """A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified."""
scope: Optional[BotCommandScopeUnion] = None scope: BotCommandScopeUnion | None = None
"""A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`.""" """A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to :class:`aiogram.types.bot_command_scope_default.BotCommandScopeDefault`."""
language_code: Optional[str] = None language_code: str | None = None
"""A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands""" """A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -31,8 +31,8 @@ class SetMyCommands(TelegramMethod[bool]):
__pydantic__self__, __pydantic__self__,
*, *,
commands: list[BotCommand], commands: list[BotCommand],
scope: Optional[BotCommandScopeUnion] = None, scope: BotCommandScopeUnion | None = None,
language_code: Optional[str] = None, language_code: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import ChatAdministratorRights from ..types import ChatAdministratorRights
from .base import TelegramMethod from .base import TelegramMethod
@ -16,9 +16,9 @@ class SetMyDefaultAdministratorRights(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
__api_method__ = "setMyDefaultAdministratorRights" __api_method__ = "setMyDefaultAdministratorRights"
rights: Optional[ChatAdministratorRights] = None rights: ChatAdministratorRights | None = None
"""A JSON-serialized object describing new default administrator rights. If not specified, the default administrator rights will be cleared.""" """A JSON-serialized object describing new default administrator rights. If not specified, the default administrator rights will be cleared."""
for_channels: Optional[bool] = None for_channels: bool | None = None
"""Pass :code:`True` to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed.""" """Pass :code:`True` to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -28,8 +28,8 @@ class SetMyDefaultAdministratorRights(TelegramMethod[bool]):
def __init__( def __init__(
__pydantic__self__, __pydantic__self__,
*, *,
rights: Optional[ChatAdministratorRights] = None, rights: ChatAdministratorRights | None = None,
for_channels: Optional[bool] = None, for_channels: bool | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from .base import TelegramMethod from .base import TelegramMethod
@ -15,9 +15,9 @@ class SetMyDescription(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
__api_method__ = "setMyDescription" __api_method__ = "setMyDescription"
description: Optional[str] = None description: str | None = None
"""New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.""" """New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language."""
language_code: Optional[str] = None language_code: str | None = None
"""A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description.""" """A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -27,8 +27,8 @@ class SetMyDescription(TelegramMethod[bool]):
def __init__( def __init__(
__pydantic__self__, __pydantic__self__,
*, *,
description: Optional[str] = None, description: str | None = None,
language_code: Optional[str] = None, language_code: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from .base import TelegramMethod from .base import TelegramMethod
@ -13,9 +13,9 @@ class SetMyName(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
__api_method__ = "setMyName" __api_method__ = "setMyName"
name: Optional[str] = None name: str | None = None
"""New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.""" """New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language."""
language_code: Optional[str] = None language_code: str | None = None
"""A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.""" """A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -25,8 +25,8 @@ class SetMyName(TelegramMethod[bool]):
def __init__( def __init__(
__pydantic__self__, __pydantic__self__,
*, *,
name: Optional[str] = None, name: str | None = None,
language_code: Optional[str] = None, language_code: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from .base import TelegramMethod from .base import TelegramMethod
@ -15,9 +15,9 @@ class SetMyShortDescription(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
__api_method__ = "setMyShortDescription" __api_method__ = "setMyShortDescription"
short_description: Optional[str] = None short_description: str | None = None
"""New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.""" """New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language."""
language_code: Optional[str] = None language_code: str | None = None
"""A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description.""" """A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -27,8 +27,8 @@ class SetMyShortDescription(TelegramMethod[bool]):
def __init__( def __init__(
__pydantic__self__, __pydantic__self__,
*, *,
short_description: Optional[str] = None, short_description: str | None = None,
language_code: Optional[str] = None, language_code: str | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from .base import TelegramMethod from .base import TelegramMethod
@ -17,7 +17,7 @@ class SetStickerKeywords(TelegramMethod[bool]):
sticker: str sticker: str
"""File identifier of the sticker""" """File identifier of the sticker"""
keywords: Optional[list[str]] = None keywords: list[str] | None = None
"""A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters""" """A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters"""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -28,7 +28,7 @@ class SetStickerKeywords(TelegramMethod[bool]):
__pydantic__self__, __pydantic__self__,
*, *,
sticker: str, sticker: str,
keywords: Optional[list[str]] = None, keywords: list[str] | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import MaskPosition from ..types import MaskPosition
from .base import TelegramMethod from .base import TelegramMethod
@ -18,7 +18,7 @@ class SetStickerMaskPosition(TelegramMethod[bool]):
sticker: str sticker: str
"""File identifier of the sticker""" """File identifier of the sticker"""
mask_position: Optional[MaskPosition] = None mask_position: MaskPosition | None = None
"""A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position.""" """A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -29,7 +29,7 @@ class SetStickerMaskPosition(TelegramMethod[bool]):
__pydantic__self__, __pydantic__self__,
*, *,
sticker: str, sticker: str,
mask_position: Optional[MaskPosition] = None, mask_position: MaskPosition | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

View file

@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional from typing import TYPE_CHECKING, Any
from ..types import InputFileUnion from ..types import InputFileUnion
from .base import TelegramMethod from .base import TelegramMethod
@ -22,7 +22,7 @@ class SetStickerSetThumbnail(TelegramMethod[bool]):
"""User identifier of the sticker set owner""" """User identifier of the sticker set owner"""
format: str format: str
"""Format of the thumbnail, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, or 'video' for a **.WEBM** video""" """Format of the thumbnail, must be one of 'static' for a **.WEBP** or **.PNG** image, 'animated' for a **.TGS** animation, or 'video' for a **.WEBM** video"""
thumbnail: Optional[InputFileUnion] = None thumbnail: InputFileUnion | None = None
"""A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see `https://core.telegram.org/stickers#animation-requirements <https://core.telegram.org/stickers#animation-requirements>`_`https://core.telegram.org/stickers#animation-requirements <https://core.telegram.org/stickers#animation-requirements>`_ for animated sticker technical requirements), or a **.WEBM** video with the thumbnail up to 32 kilobytes in size; see `https://core.telegram.org/stickers#video-requirements <https://core.telegram.org/stickers#video-requirements>`_`https://core.telegram.org/stickers#video-requirements <https://core.telegram.org/stickers#video-requirements>`_ for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.""" """A **.WEBP** or **.PNG** image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a **.TGS** animation with a thumbnail up to 32 kilobytes in size (see `https://core.telegram.org/stickers#animation-requirements <https://core.telegram.org/stickers#animation-requirements>`_`https://core.telegram.org/stickers#animation-requirements <https://core.telegram.org/stickers#animation-requirements>`_ for animated sticker technical requirements), or a **.WEBM** video with the thumbnail up to 32 kilobytes in size; see `https://core.telegram.org/stickers#video-requirements <https://core.telegram.org/stickers#video-requirements>`_`https://core.telegram.org/stickers#video-requirements <https://core.telegram.org/stickers#video-requirements>`_ for video sticker technical requirements. Pass a *file_id* as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. :ref:`More information on Sending Files » <sending-files>`. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail."""
if TYPE_CHECKING: if TYPE_CHECKING:
@ -35,7 +35,7 @@ class SetStickerSetThumbnail(TelegramMethod[bool]):
name: str, name: str,
user_id: int, user_id: int,
format: str, format: str,
thumbnail: Optional[InputFileUnion] = None, thumbnail: InputFileUnion | None = None,
**__pydantic_kwargs: Any, **__pydantic_kwargs: Any,
) -> None: ) -> None:
# DO NOT EDIT MANUALLY!!! # DO NOT EDIT MANUALLY!!!

Some files were not shown because too many files have changed in this diff Show more