Reformat descriptions (long lines)

This commit is contained in:
Alex Root Junior 2019-11-14 22:19:33 +02:00
parent d7270909a3
commit 49526814d9
136 changed files with 1713 additions and 1270 deletions

File diff suppressed because it is too large Load diff

View file

@ -15,16 +15,15 @@ class AddStickerToSet(TelegramMethod[bool]):
user_id: int user_id: int
"""User identifier of sticker set owner""" """User identifier of sticker set owner"""
name: str name: str
"""Sticker set name""" """Sticker set name"""
png_sticker: Union[InputFile, str] png_sticker: Union[InputFile, str]
"""Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. 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.""" """Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed
512px, and either width or height must be exactly 512px. 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."""
emojis: str emojis: str
"""One or more emoji corresponding to the sticker""" """One or more emoji corresponding to the sticker"""
mask_position: Optional[MaskPosition] = None mask_position: Optional[MaskPosition] = None
"""A JSON-serialized object for position where the mask should be placed on faces""" """A JSON-serialized object for position where the mask should be placed on faces"""

View file

@ -5,8 +5,12 @@ from .base import Request, TelegramMethod
class AnswerCallbackQuery(TelegramMethod[bool]): class AnswerCallbackQuery(TelegramMethod[bool]):
""" """
Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned. Use this method to send answers to callback queries sent from inline keyboards. The answer
Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @Botfather and accept the terms. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter. will be displayed to the user as a notification at the top of the chat screen or as an alert.
On success, True is returned.
Alternatively, the user can be redirected to the specified Game URL. For this option to work,
you must first create a game for your bot via @Botfather and accept the terms. Otherwise, you
may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.
Source: https://core.telegram.org/bots/api#answercallbackquery Source: https://core.telegram.org/bots/api#answercallbackquery
""" """
@ -15,20 +19,19 @@ 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: Optional[str] = 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: Optional[bool] = None
"""If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false.""" """If 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: Optional[str] = None
"""URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game note that this will only work if the query comes from a callback_game button. """URL that will be opened by the user's client. If you have created a Game and accepted the
conditions via @Botfather, specify the URL that opens your game note that this will only
Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.""" work if the query comes from a callback_game button."""
cache_time: Optional[int] = None cache_time: Optional[int] = 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."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -16,26 +16,25 @@ class AnswerInlineQuery(TelegramMethod[bool]):
inline_query_id: str inline_query_id: str
"""Unique identifier for the answered query""" """Unique identifier for the answered query"""
results: List[InlineQueryResult] results: List[InlineQueryResult]
"""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: Optional[int] = 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: Optional[bool] = None
"""Pass 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 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: Optional[str] = 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 dont support pagination. Offset length cant 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 dont support
pagination. Offset length cant exceed 64 bytes."""
switch_pm_text: Optional[str] = None switch_pm_text: Optional[str] = None
"""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"""
switch_pm_parameter: Optional[str] = None switch_pm_parameter: Optional[str] = None
"""Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed. """Deep-linking parameter for the /start message sent to the bot when user presses the switch
button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed."""
Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a Connect your YouTube account button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an oauth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -5,7 +5,10 @@ from .base import Request, TelegramMethod
class AnswerPreCheckoutQuery(TelegramMethod[bool]): class AnswerPreCheckoutQuery(TelegramMethod[bool]):
""" """
Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent. Once the user has confirmed their payment and shipping details, the Bot API sends the final
confirmation in the form of an Update with the field pre_checkout_query. Use this method to
respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must
receive an answer within 10 seconds after the pre-checkout query was sent.
Source: https://core.telegram.org/bots/api#answerprecheckoutquery Source: https://core.telegram.org/bots/api#answerprecheckoutquery
""" """
@ -14,12 +17,14 @@ class AnswerPreCheckoutQuery(TelegramMethod[bool]):
pre_checkout_query_id: str pre_checkout_query_id: str
"""Unique identifier for the query to be answered""" """Unique identifier for the query to be answered"""
ok: bool ok: bool
"""Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems.""" """Specify True if everything is alright (goods are available, etc.) and the bot is ready to
proceed with the order. Use False if there are any problems."""
error_message: Optional[str] = None error_message: Optional[str] = None
"""Required if ok is 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 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."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -6,7 +6,9 @@ from .base import Request, TelegramMethod
class AnswerShippingQuery(TelegramMethod[bool]): class AnswerShippingQuery(TelegramMethod[bool]):
""" """
If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned. If you sent an invoice requesting a shipping address and the parameter is_flexible was
specified, the Bot API will send an Update with a shipping_query field to the bot. Use this
method to reply to shipping queries. On success, True is returned.
Source: https://core.telegram.org/bots/api#answershippingquery Source: https://core.telegram.org/bots/api#answershippingquery
""" """
@ -15,15 +17,15 @@ class AnswerShippingQuery(TelegramMethod[bool]):
shipping_query_id: str shipping_query_id: str
"""Unique identifier for the query to be answered""" """Unique identifier for the query to be answered"""
ok: bool ok: bool
"""Specify True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)""" """Specify True if delivery to the specified address is possible and 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: Optional[List[ShippingOption]] = None
"""Required if ok is True. A JSON-serialized array of available shipping options.""" """Required if ok is True. A JSON-serialized array of available shipping options."""
error_message: Optional[str] = None error_message: Optional[str] = None
"""Required if ok is 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 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."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -6,7 +6,8 @@ from .base import Request, TelegramMethod
class CreateNewStickerSet(TelegramMethod[bool]): class CreateNewStickerSet(TelegramMethod[bool]):
""" """
Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success. Use this method to create new sticker set owned by a user. The bot will be able to edit the
created sticker set. Returns True on success.
Source: https://core.telegram.org/bots/api#createnewstickerset Source: https://core.telegram.org/bots/api#createnewstickerset
""" """
@ -15,22 +16,22 @@ class CreateNewStickerSet(TelegramMethod[bool]):
user_id: int user_id: int
"""User identifier of created sticker set owner""" """User identifier of created sticker set owner"""
name: str name: str
"""Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in '_by_<bot username>'. <bot_username> is case insensitive. 1-64 characters.""" """Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can
contain only english letters, digits and underscores. Must begin with a letter, can't
contain consecutive underscores and must end in '_by_<bot username>'. <bot_username> is
case insensitive. 1-64 characters."""
title: str title: str
"""Sticker set title, 1-64 characters""" """Sticker set title, 1-64 characters"""
png_sticker: Union[InputFile, str] png_sticker: Union[InputFile, str]
"""Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. 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.""" """Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed
512px, and either width or height must be exactly 512px. 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."""
emojis: str emojis: str
"""One or more emoji corresponding to the sticker""" """One or more emoji corresponding to the sticker"""
contains_masks: Optional[bool] = None contains_masks: Optional[bool] = None
"""Pass True, if a set of mask stickers should be created""" """Pass True, if a set of mask stickers should be created"""
mask_position: Optional[MaskPosition] = None mask_position: Optional[MaskPosition] = None
"""A JSON-serialized object for position where the mask should be placed on faces""" """A JSON-serialized object for position where the mask should be placed on faces"""

View file

@ -5,7 +5,9 @@ from .base import Request, TelegramMethod
class DeleteChatPhoto(TelegramMethod[bool]): class DeleteChatPhoto(TelegramMethod[bool]):
""" """
Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. Use this method to delete a chat photo. Photos can't be changed for private chats. The bot
must be an administrator in the chat for this to work and must have the appropriate admin
rights. Returns True on success.
Source: https://core.telegram.org/bots/api#deletechatphoto Source: https://core.telegram.org/bots/api#deletechatphoto
""" """
@ -13,7 +15,8 @@ class DeleteChatPhoto(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -5,7 +5,10 @@ from .base import Request, TelegramMethod
class DeleteChatStickerSet(TelegramMethod[bool]): class DeleteChatStickerSet(TelegramMethod[bool]):
""" """
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success. Use this method to delete a group sticker set from a supergroup. The bot must be an
administrator in the chat for this to work and must have the appropriate admin rights. Use the
field can_set_sticker_set optionally returned in getChat requests to check if the bot can use
this method. Returns True on success.
Source: https://core.telegram.org/bots/api#deletechatstickerset Source: https://core.telegram.org/bots/api#deletechatstickerset
""" """
@ -13,7 +16,8 @@ class DeleteChatStickerSet(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)""" """Unique identifier for the target chat or username of the target supergroup (in the format
@supergroupusername)"""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -5,13 +5,15 @@ from .base import Request, TelegramMethod
class DeleteMessage(TelegramMethod[bool]): class DeleteMessage(TelegramMethod[bool]):
""" """
Use this method to delete a message, including service messages, with the following limitations: Use this method to delete a message, including service messages, with the following
limitations:
- A message can only be deleted if it was sent less than 48 hours ago. - A message can only be deleted if it was sent less than 48 hours ago.
- Bots can delete outgoing messages in private chats, groups, and supergroups. - Bots can delete outgoing messages in private chats, groups, and supergroups.
- Bots can delete incoming messages in private chats. - Bots can delete incoming messages in private chats.
- Bots granted can_post_messages permissions can delete outgoing messages in channels. - Bots granted can_post_messages permissions can delete outgoing messages in channels.
- If the bot is an administrator of a group, it can delete any message there. - If the bot is an administrator of a group, it can delete any message there.
- If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there. - If the bot has can_delete_messages permission in a supergroup or a channel, it can delete
any message there.
Returns True on success. Returns True on success.
Source: https://core.telegram.org/bots/api#deletemessage Source: https://core.telegram.org/bots/api#deletemessage
@ -20,8 +22,8 @@ class DeleteMessage(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
message_id: int message_id: int
"""Identifier of the message to delete""" """Identifier of the message to delete"""

View file

@ -5,7 +5,8 @@ from .base import Request, TelegramMethod
class DeleteWebhook(TelegramMethod[bool]): class DeleteWebhook(TelegramMethod[bool]):
""" """
Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. Requires no parameters. Use this method to remove webhook integration if you decide to switch back to getUpdates.
Returns True on success. Requires no parameters.
Source: https://core.telegram.org/bots/api#deletewebhook Source: https://core.telegram.org/bots/api#deletewebhook
""" """

View file

@ -6,7 +6,8 @@ from .base import Request, TelegramMethod
class EditMessageCaption(TelegramMethod[Union[Message, bool]]): class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
""" """
Use this method to edit captions of messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. Use this method to edit captions of messages. On success, if edited message is sent by the
bot, the edited Message is returned, otherwise True is returned.
Source: https://core.telegram.org/bots/api#editmessagecaption Source: https://core.telegram.org/bots/api#editmessagecaption
""" """
@ -14,20 +15,17 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
__returning__ = Union[Message, bool] __returning__ = Union[Message, bool]
chat_id: Optional[Union[int, str]] = None chat_id: Optional[Union[int, str]] = None
"""Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Required if inline_message_id is not specified. Unique identifier for the target chat or
username of the target channel (in the format @channelusername)"""
message_id: Optional[int] = None message_id: Optional[int] = 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: Optional[str] = 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: Optional[str] = None
"""New caption of the message""" """New caption of the message"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an inline keyboard.""" """A JSON-serialized object for an inline keyboard."""

View file

@ -6,7 +6,10 @@ from .base import Request, TelegramMethod
class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]): class EditMessageLiveLocation(TelegramMethod[Union[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 stopMessageLiveLocation. On success, if the edited message was sent by the bot, the edited Message is returned, otherwise 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 stopMessageLiveLocation. On success, if
the edited message was sent by the bot, the edited Message is returned, otherwise True is
returned.
Source: https://core.telegram.org/bots/api#editmessagelivelocation Source: https://core.telegram.org/bots/api#editmessagelivelocation
""" """
@ -15,19 +18,15 @@ class EditMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
latitude: float latitude: float
"""Latitude of new location""" """Latitude of new location"""
longitude: float longitude: float
"""Longitude of new location""" """Longitude of new location"""
chat_id: Optional[Union[int, str]] = None chat_id: Optional[Union[int, str]] = None
"""Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Required if inline_message_id is not specified. Unique identifier for the target chat or
username of the target channel (in the format @channelusername)"""
message_id: Optional[int] = None message_id: Optional[int] = 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: Optional[str] = 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: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for a new inline keyboard.""" """A JSON-serialized object for a new inline keyboard."""

View file

@ -1,8 +1,7 @@
import secrets
from typing import Any, Dict, Optional, Union from typing import Any, Dict, Optional, Union
from ..types import InlineKeyboardMarkup, InputFile, Message
from .base import Request, TelegramMethod from .base import Request, TelegramMethod
from ..types import InlineKeyboardMarkup, InputMedia, Message, InputFile
class EditMessageMedia(TelegramMethod[Union[Message, bool]]): class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
@ -14,7 +13,7 @@ class EditMessageMedia(TelegramMethod[Union[Message, bool]]):
__returning__ = Union[Message, bool] __returning__ = Union[Message, bool]
media: InputMedia media: Union[str, InputFile]
"""A JSON-serialized object for a new media content of the message""" """A JSON-serialized object for a new media content of the message"""
chat_id: Optional[Union[int, str]] = None chat_id: Optional[Union[int, str]] = None

View file

@ -6,7 +6,8 @@ from .base import Request, TelegramMethod
class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]): class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]):
""" """
Use this method to edit only the reply markup of messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. Use this method to edit only the reply markup of messages. On success, if edited message is
sent by the bot, the edited Message is returned, otherwise True is returned.
Source: https://core.telegram.org/bots/api#editmessagereplymarkup Source: https://core.telegram.org/bots/api#editmessagereplymarkup
""" """
@ -14,14 +15,12 @@ class EditMessageReplyMarkup(TelegramMethod[Union[Message, bool]]):
__returning__ = Union[Message, bool] __returning__ = Union[Message, bool]
chat_id: Optional[Union[int, str]] = None chat_id: Optional[Union[int, str]] = None
"""Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Required if inline_message_id is not specified. Unique identifier for the target chat or
username of the target channel (in the format @channelusername)"""
message_id: Optional[int] = None message_id: Optional[int] = 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: Optional[str] = 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: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an inline keyboard.""" """A JSON-serialized object for an inline keyboard."""

View file

@ -6,7 +6,8 @@ from .base import Request, TelegramMethod
class EditMessageText(TelegramMethod[Union[Message, bool]]): class EditMessageText(TelegramMethod[Union[Message, bool]]):
""" """
Use this method to edit text and game messages. On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. Use this method to edit text and game messages. On success, if edited message is sent by the
bot, the edited Message is returned, otherwise True is returned.
Source: https://core.telegram.org/bots/api#editmessagetext Source: https://core.telegram.org/bots/api#editmessagetext
""" """
@ -15,22 +16,18 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]):
text: str text: str
"""New text of the message""" """New text of the message"""
chat_id: Optional[Union[int, str]] = None chat_id: Optional[Union[int, str]] = None
"""Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Required if inline_message_id is not specified. Unique identifier for the target chat or
username of the target channel (in the format @channelusername)"""
message_id: Optional[int] = None message_id: Optional[int] = 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: Optional[str] = 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[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in your bot's message."""
disable_web_page_preview: Optional[bool] = None disable_web_page_preview: Optional[bool] = None
"""Disables link previews for links in this message""" """Disables link previews for links in this message"""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an inline keyboard.""" """A JSON-serialized object for an inline keyboard."""

View file

@ -5,8 +5,14 @@ from .base import Request, TelegramMethod
class ExportChatInviteLink(TelegramMethod[str]): class ExportChatInviteLink(TelegramMethod[str]):
""" """
Use this method to generate a new invite link for a chat; any previously generated link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the new invite link as String on success. Use this method to generate a new invite link for a chat; any previously generated link is
Note: Each administrator in a chat generates their own invite links. Bots can't use invite links generated by other administrators. If you want your bot to work with invite links, it will need to generate its own link using exportChatInviteLink after this the link will become available to the bot via the getChat method. If your bot needs to generate a new invite link replacing its previous one, use exportChatInviteLink again. revoked. The bot must be an administrator in the chat for this to work and must have the
appropriate admin rights. Returns the new invite link as String on success.
Note: Each administrator in a chat generates their own invite links. Bots can't use invite
links generated by other administrators. If you want your bot to work with invite links, it
will need to generate its own link using exportChatInviteLink after this the link will
become available to the bot via the getChat method. If your bot needs to generate a new invite
link replacing its previous one, use exportChatInviteLink again.
Source: https://core.telegram.org/bots/api#exportchatinvitelink Source: https://core.telegram.org/bots/api#exportchatinvitelink
""" """
@ -14,7 +20,8 @@ class ExportChatInviteLink(TelegramMethod[str]):
__returning__ = str __returning__ = str
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -14,14 +14,13 @@ class ForwardMessage(TelegramMethod[Message]):
__returning__ = Message __returning__ = Message
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
from_chat_id: Union[int, str] from_chat_id: Union[int, str]
"""Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)""" """Unique identifier for the chat where the original message was sent (or channel username in
the format @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"""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = 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."""

View file

@ -6,7 +6,9 @@ from .base import Request, TelegramMethod
class GetChat(TelegramMethod[Chat]): class GetChat(TelegramMethod[Chat]):
""" """
Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat object on success. Use this method to get up to date information about the chat (current name of the user for
one-on-one conversations, current username of a user, group or channel, etc.). Returns a Chat
object on success.
Source: https://core.telegram.org/bots/api#getchat Source: https://core.telegram.org/bots/api#getchat
""" """
@ -14,7 +16,8 @@ class GetChat(TelegramMethod[Chat]):
__returning__ = Chat __returning__ = Chat
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target supergroup or channel (in
the format @channelusername)"""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -6,7 +6,10 @@ from .base import Request, TelegramMethod
class GetChatAdministrators(TelegramMethod[List[ChatMember]]): class GetChatAdministrators(TelegramMethod[List[ChatMember]]):
""" """
Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned. Use this method to get a list of administrators in a chat. On success, returns an Array of
ChatMember objects that contains information about all chat administrators except other bots.
If the chat is a group or a supergroup and no administrators were appointed, only the creator
will be returned.
Source: https://core.telegram.org/bots/api#getchatadministrators Source: https://core.telegram.org/bots/api#getchatadministrators
""" """
@ -14,7 +17,8 @@ class GetChatAdministrators(TelegramMethod[List[ChatMember]]):
__returning__ = List[ChatMember] __returning__ = List[ChatMember]
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target supergroup or channel (in
the format @channelusername)"""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -6,7 +6,8 @@ from .base import Request, TelegramMethod
class GetChatMember(TelegramMethod[ChatMember]): class GetChatMember(TelegramMethod[ChatMember]):
""" """
Use this method to get information about a member of a chat. Returns a ChatMember object on success. Use this method to get information about a member of a chat. Returns a ChatMember object on
success.
Source: https://core.telegram.org/bots/api#getchatmember Source: https://core.telegram.org/bots/api#getchatmember
""" """
@ -14,8 +15,8 @@ class GetChatMember(TelegramMethod[ChatMember]):
__returning__ = ChatMember __returning__ = ChatMember
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target supergroup or channel (in
the format @channelusername)"""
user_id: int user_id: int
"""Unique identifier of the target user""" """Unique identifier of the target user"""

View file

@ -13,7 +13,8 @@ class GetChatMembersCount(TelegramMethod[int]):
__returning__ = int __returning__ = int
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target supergroup or channel (in
the format @channelusername)"""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -6,8 +6,13 @@ from .base import Request, TelegramMethod
class GetFile(TelegramMethod[File]): class GetFile(TelegramMethod[File]):
""" """
Use this method to get basic info about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again. Use this method to get basic info about a file and prepare it for downloading. For the moment,
Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received. bots can download files of up to 20MB in size. On success, a File object is returned. The file
can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>,
where <file_path> is taken from the response. It is guaranteed that the link will be valid for
at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
Note: This function may not preserve the original file name and MIME type. You should save the
file's MIME type and name (if available) when the File object is received.
Source: https://core.telegram.org/bots/api#getfile Source: https://core.telegram.org/bots/api#getfile
""" """

View file

@ -6,8 +6,11 @@ from .base import Request, TelegramMethod
class GetGameHighScores(TelegramMethod[List[GameHighScore]]): class GetGameHighScores(TelegramMethod[List[GameHighScore]]):
""" """
Use this method to get data for high score tables. Will return the score of the specified user and several of his neighbors in a game. On success, returns an Array of GameHighScore objects. Use this method to get data for high score tables. Will return the score of the specified user
This method will currently return scores for the target user, plus two of his closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them. Please note that this behavior is subject to change. and several of his neighbors in a game. On success, returns an Array of GameHighScore objects.
This method will currently return scores for the target user, plus two of his closest
neighbors on each side. Will also return the top three users if the user and his neighbors are
not among them. Please note that this behavior is subject to change.
Source: https://core.telegram.org/bots/api#getgamehighscores Source: https://core.telegram.org/bots/api#getgamehighscores
""" """
@ -16,13 +19,10 @@ class GetGameHighScores(TelegramMethod[List[GameHighScore]]):
user_id: int user_id: int
"""Target user id""" """Target user id"""
chat_id: Optional[int] = None chat_id: Optional[int] = 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: Optional[int] = 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: Optional[str] = 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"""

View file

@ -6,7 +6,8 @@ from .base import Request, TelegramMethod
class GetMe(TelegramMethod[User]): class GetMe(TelegramMethod[User]):
""" """
A simple method for testing your bot's auth token. Requires no parameters. Returns basic information about the bot in form of a User object. A simple method for testing your bot's auth token. Requires no parameters. Returns basic
information about the bot in form of a User object.
Source: https://core.telegram.org/bots/api#getme Source: https://core.telegram.org/bots/api#getme
""" """

View file

@ -6,7 +6,8 @@ from .base import Request, TelegramMethod
class GetUpdates(TelegramMethod[List[Update]]): class GetUpdates(TelegramMethod[List[Update]]):
""" """
Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned. Use this method to receive incoming updates using long polling (wiki). An Array of Update
objects is returned.
Notes Notes
1. This method will not work if an outgoing webhook is set up. 1. This method will not work if an outgoing webhook is set up.
2. In order to avoid getting duplicate updates, recalculate offset after each server response. 2. In order to avoid getting duplicate updates, recalculate offset after each server response.
@ -17,18 +18,23 @@ class GetUpdates(TelegramMethod[List[Update]]):
__returning__ = List[Update] __returning__ = List[Update]
offset: Optional[int] = None offset: Optional[int] = 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 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 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
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 forgotten."""
limit: Optional[int] = None limit: Optional[int] = 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: Optional[int] = 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: Optional[List[str]] = None
"""List the types of updates you want your bot to receive. For example, specify ['message', 'edited_channel_post', 'callback_query'] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used. """List the types of updates you want your bot to receive. For example, specify ['message',
'edited_channel_post', 'callback_query'] to only receive updates of these types. See Update
Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.""" for a complete list of available update types. Specify an empty list to receive all updates
regardless of type (default). If not specified, the previous setting will be used."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -6,7 +6,8 @@ from .base import Request, TelegramMethod
class GetUserProfilePhotos(TelegramMethod[UserProfilePhotos]): class GetUserProfilePhotos(TelegramMethod[UserProfilePhotos]):
""" """
Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos
object.
Source: https://core.telegram.org/bots/api#getuserprofilephotos Source: https://core.telegram.org/bots/api#getuserprofilephotos
""" """
@ -15,12 +16,11 @@ 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: Optional[int] = 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: Optional[int] = 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."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -6,7 +6,9 @@ from .base import Request, TelegramMethod
class GetWebhookInfo(TelegramMethod[WebhookInfo]): class GetWebhookInfo(TelegramMethod[WebhookInfo]):
""" """
Use this method to get current webhook status. Requires no parameters. On success, returns a WebhookInfo object. If the bot is using getUpdates, will return an object with the url field empty. Use this method to get current webhook status. Requires no parameters. On success, returns a
WebhookInfo object. If the bot is using getUpdates, will return an object with the url field
empty.
Source: https://core.telegram.org/bots/api#getwebhookinfo Source: https://core.telegram.org/bots/api#getwebhookinfo
""" """

View file

@ -6,7 +6,10 @@ from .base import Request, TelegramMethod
class KickChatMember(TelegramMethod[bool]): class KickChatMember(TelegramMethod[bool]):
""" """
Use this method to kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. Use this method to kick a user from a group, a supergroup or a channel. In the case of
supergroups and channels, the user will not be able to return to the group on their own using
invite links, etc., unless unbanned first. The bot must be an administrator in the chat for
this to work and must have the appropriate admin rights. Returns True on success.
Source: https://core.telegram.org/bots/api#kickchatmember Source: https://core.telegram.org/bots/api#kickchatmember
""" """
@ -14,13 +17,13 @@ class KickChatMember(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)""" """Unique identifier for the target group or username of the target supergroup or channel (in
the format @channelusername)"""
user_id: int user_id: int
"""Unique identifier of the target user""" """Unique identifier of the target user"""
until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = 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""" """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"""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -13,7 +13,8 @@ class LeaveChat(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target supergroup or channel (in
the format @channelusername)"""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -5,7 +5,9 @@ from .base import Request, TelegramMethod
class PinChatMessage(TelegramMethod[bool]): class PinChatMessage(TelegramMethod[bool]):
""" """
Use this method to pin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the can_pin_messages admin right in the supergroup or can_edit_messages admin right in the channel. Returns True on success. Use this method to pin a message in a group, a supergroup, or a channel. The bot must be an
administrator in the chat for this to work and must have the can_pin_messages admin right in
the supergroup or can_edit_messages admin right in the channel. Returns True on success.
Source: https://core.telegram.org/bots/api#pinchatmessage Source: https://core.telegram.org/bots/api#pinchatmessage
""" """
@ -13,13 +15,13 @@ class PinChatMessage(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
message_id: int message_id: int
"""Identifier of a message to pin""" """Identifier of a message to pin"""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = None
"""Pass 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.""" """Pass 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."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -5,7 +5,9 @@ from .base import Request, TelegramMethod
class PromoteChatMember(TelegramMethod[bool]): class PromoteChatMember(TelegramMethod[bool]):
""" """
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user. Returns True on success. Use this method to promote or demote a user in a supergroup or a channel. The bot must be an
administrator in the chat for this to work and must have the appropriate admin rights. Pass
False for all boolean parameters to demote a user. Returns True on success.
Source: https://core.telegram.org/bots/api#promotechatmember Source: https://core.telegram.org/bots/api#promotechatmember
""" """
@ -13,34 +15,29 @@ class PromoteChatMember(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
user_id: int user_id: int
"""Unique identifier of the target user""" """Unique identifier of the target user"""
can_change_info: Optional[bool] = None can_change_info: Optional[bool] = None
"""Pass True, if the administrator can change chat title, photo and other settings""" """Pass True, if the administrator can change chat title, photo and other settings"""
can_post_messages: Optional[bool] = None can_post_messages: Optional[bool] = None
"""Pass True, if the administrator can create channel posts, channels only""" """Pass True, if the administrator can create channel posts, channels only"""
can_edit_messages: Optional[bool] = None can_edit_messages: Optional[bool] = None
"""Pass True, if the administrator can edit messages of other users and can pin messages, channels only""" """Pass True, if the administrator can edit messages of other users and can pin messages,
channels only"""
can_delete_messages: Optional[bool] = None can_delete_messages: Optional[bool] = None
"""Pass True, if the administrator can delete messages of other users""" """Pass True, if the administrator can delete messages of other users"""
can_invite_users: Optional[bool] = None can_invite_users: Optional[bool] = None
"""Pass True, if the administrator can invite new users to the chat""" """Pass True, if the administrator can invite new users to the chat"""
can_restrict_members: Optional[bool] = None can_restrict_members: Optional[bool] = None
"""Pass True, if the administrator can restrict, ban or unban chat members""" """Pass True, if the administrator can restrict, ban or unban chat members"""
can_pin_messages: Optional[bool] = None can_pin_messages: Optional[bool] = None
"""Pass True, if the administrator can pin messages, supergroups only""" """Pass True, if the administrator can pin messages, supergroups only"""
can_promote_members: Optional[bool] = None can_promote_members: Optional[bool] = None
"""Pass True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)""" """Pass True, if the administrator can add new administrators with a subset of his own
privileges or demote administrators that he has promoted, directly or indirectly (promoted
by administrators that were appointed by him)"""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -7,7 +7,9 @@ from .base import Request, TelegramMethod
class RestrictChatMember(TelegramMethod[bool]): class RestrictChatMember(TelegramMethod[bool]):
""" """
Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all permissions to lift restrictions from a user. Returns True on success. Use this method to restrict a user in a supergroup. The bot must be an administrator in the
supergroup for this to work and must have the appropriate admin rights. Pass True for all
permissions to lift restrictions from a user. Returns True on success.
Source: https://core.telegram.org/bots/api#restrictchatmember Source: https://core.telegram.org/bots/api#restrictchatmember
""" """
@ -15,16 +17,16 @@ class RestrictChatMember(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)""" """Unique identifier for the target chat or username of the target supergroup (in the format
@supergroupusername)"""
user_id: int user_id: int
"""Unique identifier of the target user""" """Unique identifier of the target user"""
permissions: ChatPermissions permissions: ChatPermissions
"""New user permissions""" """New user permissions"""
until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = 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"""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -13,7 +13,9 @@ from .base import Request, TelegramMethod
class SendAnimation(TelegramMethod[Message]): class SendAnimation(TelegramMethod[Message]):
""" """
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future. Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On
success, the sent Message is returned. Bots can currently send animation files of up to 50 MB
in size, this limit may be changed in the future.
Source: https://core.telegram.org/bots/api#sendanimation Source: https://core.telegram.org/bots/api#sendanimation
""" """
@ -21,39 +23,39 @@ class SendAnimation(TelegramMethod[Message]):
__returning__ = Message __returning__ = Message
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
animation: Union[InputFile, str] animation: Union[InputFile, str]
"""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.""" """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."""
duration: Optional[int] = None duration: Optional[int] = None
"""Duration of sent animation in seconds""" """Duration of sent animation in seconds"""
width: Optional[int] = None width: Optional[int] = None
"""Animation width""" """Animation width"""
height: Optional[int] = None height: Optional[int] = None
"""Animation height""" """Animation height"""
thumb: Optional[Union[InputFile, str]] = None thumb: Optional[Union[InputFile, str]] = 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 thumbnails width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails cant 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>.""" """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 thumbnails width and height should not exceed 320. Ignored if the file is not uploaded
using multipart/form-data. Thumbnails cant 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>."""
caption: Optional[str] = None caption: Optional[str] = None
"""Animation caption (may also be used when resending animation by file_id), 0-1024 characters""" """Animation caption (may also be used when resending animation by file_id), 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = 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."""
reply_to_message_id: Optional[int] = None reply_to_message_id: Optional[int] = None
"""If the message is a reply, ID of the original message""" """If the message is a reply, ID of the original message"""
reply_markup: Optional[ reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None ] = None
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply
keyboard, instructions to remove reply keyboard or to force a reply from the user."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict( data: Dict[str, Any] = self.dict(

View file

@ -13,7 +13,10 @@ from .base import Request, TelegramMethod
class SendAudio(TelegramMethod[Message]): class SendAudio(TelegramMethod[Message]):
""" """
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future. Use this method to send audio files, if you want Telegram clients to display them in the music
player. Your audio must be in the .MP3 or .M4A format. On success, the sent Message is
returned. Bots can currently send audio files of up to 50 MB in size, this limit may be
changed in the future.
For sending voice messages, use the sendVoice method instead. For sending voice messages, use the sendVoice method instead.
Source: https://core.telegram.org/bots/api#sendaudio Source: https://core.telegram.org/bots/api#sendaudio
@ -22,39 +25,39 @@ class SendAudio(TelegramMethod[Message]):
__returning__ = Message __returning__ = Message
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
audio: Union[InputFile, str] audio: Union[InputFile, str]
"""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.""" """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."""
caption: Optional[str] = None caption: Optional[str] = None
"""Audio caption, 0-1024 characters""" """Audio caption, 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
duration: Optional[int] = None duration: Optional[int] = None
"""Duration of the audio in seconds""" """Duration of the audio in seconds"""
performer: Optional[str] = None performer: Optional[str] = None
"""Performer""" """Performer"""
title: Optional[str] = None title: Optional[str] = None
"""Track name""" """Track name"""
thumb: Optional[Union[InputFile, str]] = None thumb: Optional[Union[InputFile, str]] = 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 thumbnails width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails cant 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>.""" """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 thumbnails width and height should not exceed 320. Ignored if the file is not uploaded
using multipart/form-data. Thumbnails cant 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>."""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = 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."""
reply_to_message_id: Optional[int] = None reply_to_message_id: Optional[int] = None
"""If the message is a reply, ID of the original message""" """If the message is a reply, ID of the original message"""
reply_markup: Optional[ reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None ] = None
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply
keyboard, instructions to remove reply keyboard or to force a reply from the user."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict( data: Dict[str, Any] = self.dict(

View file

@ -5,9 +5,15 @@ from .base import Request, TelegramMethod
class SendChatAction(TelegramMethod[bool]): class SendChatAction(TelegramMethod[bool]):
""" """
Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success. Use this method when you need to tell the user that something is happening on the bot's side.
Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of 'Retrieving image, please wait…', the bot may use sendChatAction with action = upload_photo. The user will see a 'sending photo' status for the bot. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram
We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive. clients clear its typing status). Returns True on success.
Example: The ImageBot needs some time to process a request and upload the image. Instead of
sending a text message along the lines of 'Retrieving image, please wait…', the bot may use
sendChatAction with action = upload_photo. The user will see a 'sending photo' status for the
bot.
We only recommend using this method when a response from the bot will take a noticeable amount
of time to arrive.
Source: https://core.telegram.org/bots/api#sendchataction Source: https://core.telegram.org/bots/api#sendchataction
""" """
@ -15,10 +21,13 @@ class SendChatAction(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
action: str action: str
"""Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_audio or upload_audio for audio files, upload_document for general files, find_location for location data, record_video_note or upload_video_note for video notes.""" """Type of action to broadcast. Choose one, depending on what the user is about to receive:
typing for text messages, upload_photo for photos, record_video or upload_video for videos,
record_audio or upload_audio for audio files, upload_document for general files,
find_location for location data, record_video_note or upload_video_note for video notes."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -20,30 +20,25 @@ class SendContact(TelegramMethod[Message]):
__returning__ = Message __returning__ = Message
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
phone_number: str phone_number: str
"""Contact's phone number""" """Contact's phone number"""
first_name: str first_name: str
"""Contact's first name""" """Contact's first name"""
last_name: Optional[str] = None last_name: Optional[str] = None
"""Contact's last name""" """Contact's last name"""
vcard: Optional[str] = None vcard: Optional[str] = None
"""Additional data about the contact in the form of a vCard, 0-2048 bytes""" """Additional data about the contact in the form of a vCard, 0-2048 bytes"""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = 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."""
reply_to_message_id: Optional[int] = None reply_to_message_id: Optional[int] = None
"""If the message is a reply, ID of the original message""" """If the message is a reply, ID of the original message"""
reply_markup: Optional[ reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None ] = None
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove keyboard or to force a reply from the user.""" """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply
keyboard, instructions to remove keyboard or to force a reply from the user."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -13,7 +13,9 @@ from .base import Request, TelegramMethod
class SendDocument(TelegramMethod[Message]): class SendDocument(TelegramMethod[Message]):
""" """
Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future. Use this method to send general files. On success, the sent Message is returned. Bots can
currently send files of any type of up to 50 MB in size, this limit may be changed in the
future.
Source: https://core.telegram.org/bots/api#senddocument Source: https://core.telegram.org/bots/api#senddocument
""" """
@ -21,30 +23,33 @@ class SendDocument(TelegramMethod[Message]):
__returning__ = Message __returning__ = Message
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
document: Union[InputFile, str] document: Union[InputFile, str]
"""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.""" """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."""
thumb: Optional[Union[InputFile, str]] = None thumb: Optional[Union[InputFile, str]] = 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 thumbnails width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails cant 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>.""" """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 thumbnails width and height should not exceed 320. Ignored if the file is not uploaded
using multipart/form-data. Thumbnails cant 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>."""
caption: Optional[str] = None caption: Optional[str] = None
"""Document caption (may also be used when resending documents by file_id), 0-1024 characters""" """Document caption (may also be used when resending documents by file_id), 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = 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."""
reply_to_message_id: Optional[int] = None reply_to_message_id: Optional[int] = None
"""If the message is a reply, ID of the original message""" """If the message is a reply, ID of the original message"""
reply_markup: Optional[ reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None ] = None
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply
keyboard, instructions to remove reply keyboard or to force a reply from the user."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict( data: Dict[str, Any] = self.dict(

View file

@ -15,18 +15,16 @@ class SendGame(TelegramMethod[Message]):
chat_id: int chat_id: int
"""Unique identifier for the target chat""" """Unique identifier for the target chat"""
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.""" """Short name of the game, serves as the unique identifier for the game. Set up your games via
Botfather."""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = 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."""
reply_to_message_id: Optional[int] = None reply_to_message_id: Optional[int] = None
"""If the message is a reply, ID of the original message""" """If the message is a reply, ID of the original message"""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an inline keyboard. 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. If empty, one Play game_title button
will be shown. If not empty, the first button must launch the game."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -15,72 +15,56 @@ class SendInvoice(TelegramMethod[Message]):
chat_id: int chat_id: int
"""Unique identifier for the target private chat""" """Unique identifier for the target private chat"""
title: str title: str
"""Product name, 1-32 characters""" """Product name, 1-32 characters"""
description: str description: str
"""Product description, 1-255 characters""" """Product description, 1-255 characters"""
payload: str payload: str
"""Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.""" """Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for
your internal processes."""
provider_token: str provider_token: str
"""Payments provider token, obtained via Botfather""" """Payments provider token, obtained via Botfather"""
start_parameter: str start_parameter: str
"""Unique deep-linking parameter that can be used to generate this invoice when used as a start parameter""" """Unique deep-linking parameter that can be used to generate this invoice when used as a
start parameter"""
currency: str currency: str
"""Three-letter ISO 4217 currency code, see more on currencies""" """Three-letter ISO 4217 currency code, see more on currencies"""
prices: List[LabeledPrice] prices: List[LabeledPrice]
"""Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)""" """Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost,
delivery tax, bonus, etc.)"""
provider_data: Optional[str] = None provider_data: Optional[str] = None
"""JSON-encoded 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-encoded 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: Optional[str] = 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: Optional[int] = None
"""Photo size""" """Photo size"""
photo_width: Optional[int] = None photo_width: Optional[int] = None
"""Photo width""" """Photo width"""
photo_height: Optional[int] = None photo_height: Optional[int] = None
"""Photo height""" """Photo height"""
need_name: Optional[bool] = None need_name: Optional[bool] = None
"""Pass True, if you require the user's full name to complete the order""" """Pass True, if you require the user's full name to complete the order"""
need_phone_number: Optional[bool] = None need_phone_number: Optional[bool] = None
"""Pass True, if you require the user's phone number to complete the order""" """Pass True, if you require the user's phone number to complete the order"""
need_email: Optional[bool] = None need_email: Optional[bool] = None
"""Pass True, if you require the user's email address to complete the order""" """Pass True, if you require the user's email address to complete the order"""
need_shipping_address: Optional[bool] = None need_shipping_address: Optional[bool] = None
"""Pass True, if you require the user's shipping address to complete the order""" """Pass True, if you require the user's shipping address to complete the order"""
send_phone_number_to_provider: Optional[bool] = None send_phone_number_to_provider: Optional[bool] = None
"""Pass True, if user's phone number should be sent to provider""" """Pass True, if user's phone number should be sent to provider"""
send_email_to_provider: Optional[bool] = None send_email_to_provider: Optional[bool] = None
"""Pass True, if user's email address should be sent to provider""" """Pass True, if user's email address should be sent to provider"""
is_flexible: Optional[bool] = None is_flexible: Optional[bool] = None
"""Pass True, if the final price depends on the shipping method""" """Pass True, if the final price depends on the shipping method"""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = 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."""
reply_to_message_id: Optional[int] = None reply_to_message_id: Optional[int] = None
"""If the message is a reply, ID of the original message""" """If the message is a reply, ID of the original message"""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for an inline keyboard. If empty, one 'Pay 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. If empty, one 'Pay total price' button
will be shown. If not empty, the first button must be a Pay button."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -20,27 +20,24 @@ class SendLocation(TelegramMethod[Message]):
__returning__ = Message __returning__ = Message
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
latitude: float latitude: float
"""Latitude of the location""" """Latitude of the location"""
longitude: float longitude: float
"""Longitude of the location""" """Longitude of the location"""
live_period: Optional[int] = None live_period: Optional[int] = None
"""Period in seconds for which the location will be updated (see Live Locations, should be between 60 and 86400.""" """Period in seconds for which the location will be updated (see Live Locations, should be
between 60 and 86400."""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = 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."""
reply_to_message_id: Optional[int] = None reply_to_message_id: Optional[int] = None
"""If the message is a reply, ID of the original message""" """If the message is a reply, ID of the original message"""
reply_markup: Optional[ reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None ] = None
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply
keyboard, instructions to remove reply keyboard or to force a reply from the user."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -1,13 +1,13 @@
import secrets
from typing import Any, Dict, List, Optional, Union from typing import Any, Dict, List, Optional, Union
from .base import Request, TelegramMethod
from ..types import InputMediaPhoto, InputMediaVideo, Message, InputFile from ..types import InputMediaPhoto, InputMediaVideo, Message, InputFile
from .base import Request, TelegramMethod
class SendMediaGroup(TelegramMethod[List[Message]]): class SendMediaGroup(TelegramMethod[List[Message]]):
""" """
Use this method to send a group of photos or videos as an album. On success, an array of the sent Messages is returned. Use this method to send a group of photos or videos as an album. On success, an array of the
sent Messages is returned.
Source: https://core.telegram.org/bots/api#sendmediagroup Source: https://core.telegram.org/bots/api#sendmediagroup
""" """
@ -15,14 +15,12 @@ class SendMediaGroup(TelegramMethod[List[Message]]):
__returning__ = List[Message] __returning__ = List[Message]
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
media: List[Union[InputMediaPhoto, InputMediaVideo]] media: List[Union[InputMediaPhoto, InputMediaVideo]]
"""A JSON-serialized array describing photos and videos to be sent, must include 210 items""" """A JSON-serialized array describing photos and videos to be sent, must include 210 items"""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = None
"""Sends the messages silently. Users will receive a notification with no sound.""" """Sends the messages silently. Users will receive a notification with no sound."""
reply_to_message_id: Optional[int] = None reply_to_message_id: Optional[int] = None
"""If the messages are a reply, ID of the original message""" """If the messages are a reply, ID of the original message"""

View file

@ -20,27 +20,24 @@ class SendMessage(TelegramMethod[Message]):
__returning__ = Message __returning__ = Message
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
text: str text: str
"""Text of the message to be sent""" """Text of the message to be sent"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in your bot's message."""
disable_web_page_preview: Optional[bool] = None disable_web_page_preview: Optional[bool] = None
"""Disables link previews for links in this message""" """Disables link previews for links in this message"""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = 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."""
reply_to_message_id: Optional[int] = None reply_to_message_id: Optional[int] = None
"""If the message is a reply, ID of the original message""" """If the message is a reply, ID of the original message"""
reply_markup: Optional[ reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None ] = None
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply
keyboard, instructions to remove reply keyboard or to force a reply from the user."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -21,27 +21,26 @@ class SendPhoto(TelegramMethod[Message]):
__returning__ = Message __returning__ = Message
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
photo: Union[InputFile, str] photo: Union[InputFile, str]
"""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.""" """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."""
caption: Optional[str] = None caption: Optional[str] = None
"""Photo caption (may also be used when resending photos by file_id), 0-1024 characters""" """Photo caption (may also be used when resending photos by file_id), 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = 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."""
reply_to_message_id: Optional[int] = None reply_to_message_id: Optional[int] = None
"""If the message is a reply, ID of the original message""" """If the message is a reply, ID of the original message"""
reply_markup: Optional[ reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None ] = None
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply
keyboard, instructions to remove reply keyboard or to force a reply from the user."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict( data: Dict[str, Any] = self.dict(

View file

@ -12,7 +12,8 @@ from .base import Request, TelegramMethod
class SendPoll(TelegramMethod[Message]): class SendPoll(TelegramMethod[Message]):
""" """
Use this method to send a native poll. A native poll can't be sent to a private chat. On success, the sent Message is returned. Use this method to send a native poll. A native poll can't be sent to a private chat. On
success, the sent Message is returned.
Source: https://core.telegram.org/bots/api#sendpoll Source: https://core.telegram.org/bots/api#sendpoll
""" """
@ -20,24 +21,21 @@ class SendPoll(TelegramMethod[Message]):
__returning__ = Message __returning__ = Message
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername). A native poll can't be sent to a private chat.""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername). A native poll can't be sent to a private chat."""
question: str question: str
"""Poll question, 1-255 characters""" """Poll question, 1-255 characters"""
options: List[str] options: List[str]
"""List of answer options, 2-10 strings 1-100 characters each""" """List of answer options, 2-10 strings 1-100 characters each"""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = 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."""
reply_to_message_id: Optional[int] = None reply_to_message_id: Optional[int] = None
"""If the message is a reply, ID of the original message""" """If the message is a reply, ID of the original message"""
reply_markup: Optional[ reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None ] = None
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply
keyboard, instructions to remove reply keyboard or to force a reply from the user."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -13,7 +13,8 @@ from .base import Request, TelegramMethod
class SendSticker(TelegramMethod[Message]): class SendSticker(TelegramMethod[Message]):
""" """
Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message is returned. Use this method to send static .WEBP or animated .TGS stickers. On success, the sent Message
is returned.
Source: https://core.telegram.org/bots/api#sendsticker Source: https://core.telegram.org/bots/api#sendsticker
""" """
@ -21,21 +22,21 @@ class SendSticker(TelegramMethod[Message]):
__returning__ = Message __returning__ = Message
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
sticker: Union[InputFile, str] sticker: Union[InputFile, str]
"""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 file from the Internet, or upload a new one using multipart/form-data.""" """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 file from
the Internet, or upload a new one using multipart/form-data."""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = 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."""
reply_to_message_id: Optional[int] = None reply_to_message_id: Optional[int] = None
"""If the message is a reply, ID of the original message""" """If the message is a reply, ID of the original message"""
reply_markup: Optional[ reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None ] = None
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply
keyboard, instructions to remove reply keyboard or to force a reply from the user."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict( data: Dict[str, Any] = self.dict(

View file

@ -20,36 +20,30 @@ class SendVenue(TelegramMethod[Message]):
__returning__ = Message __returning__ = Message
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
latitude: float latitude: float
"""Latitude of the venue""" """Latitude of the venue"""
longitude: float longitude: float
"""Longitude of the venue""" """Longitude of the venue"""
title: str title: str
"""Name of the venue""" """Name of the venue"""
address: str address: str
"""Address of the venue""" """Address of the venue"""
foursquare_id: Optional[str] = None foursquare_id: Optional[str] = None
"""Foursquare identifier of the venue""" """Foursquare identifier of the venue"""
foursquare_type: Optional[str] = None foursquare_type: Optional[str] = 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'.)"""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = 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."""
reply_to_message_id: Optional[int] = None reply_to_message_id: Optional[int] = None
"""If the message is a reply, ID of the original message""" """If the message is a reply, ID of the original message"""
reply_markup: Optional[ reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None ] = None
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply
keyboard, instructions to remove reply keyboard or to force a reply from the user."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -13,7 +13,9 @@ from .base import Request, TelegramMethod
class SendVideo(TelegramMethod[Message]): class SendVideo(TelegramMethod[Message]):
""" """
Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future. Use this method to send video files, Telegram clients support mp4 videos (other formats may be
sent as Document). On success, the sent Message is returned. Bots can currently send video
files of up to 50 MB in size, this limit may be changed in the future.
Source: https://core.telegram.org/bots/api#sendvideo Source: https://core.telegram.org/bots/api#sendvideo
""" """
@ -21,42 +23,41 @@ class SendVideo(TelegramMethod[Message]):
__returning__ = Message __returning__ = Message
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
video: Union[InputFile, str] video: Union[InputFile, str]
"""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.""" """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."""
duration: Optional[int] = None duration: Optional[int] = None
"""Duration of sent video in seconds""" """Duration of sent video in seconds"""
width: Optional[int] = None width: Optional[int] = None
"""Video width""" """Video width"""
height: Optional[int] = None height: Optional[int] = None
"""Video height""" """Video height"""
thumb: Optional[Union[InputFile, str]] = None thumb: Optional[Union[InputFile, str]] = 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 thumbnails width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails cant 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>.""" """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 thumbnails width and height should not exceed 320. Ignored if the file is not uploaded
using multipart/form-data. Thumbnails cant 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>."""
caption: Optional[str] = None caption: Optional[str] = None
"""Video caption (may also be used when resending videos by file_id), 0-1024 characters""" """Video caption (may also be used when resending videos by file_id), 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
supports_streaming: Optional[bool] = None supports_streaming: Optional[bool] = None
"""Pass True, if the uploaded video is suitable for streaming""" """Pass True, if the uploaded video is suitable for streaming"""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = 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."""
reply_to_message_id: Optional[int] = None reply_to_message_id: Optional[int] = None
"""If the message is a reply, ID of the original message""" """If the message is a reply, ID of the original message"""
reply_markup: Optional[ reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None ] = None
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply
keyboard, instructions to remove reply keyboard or to force a reply from the user."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict( data: Dict[str, Any] = self.dict(

View file

@ -13,7 +13,8 @@ from .base import Request, TelegramMethod
class SendVideoNote(TelegramMethod[Message]): class SendVideoNote(TelegramMethod[Message]):
""" """
As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned. As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long. Use
this method to send video messages. On success, the sent Message is returned.
Source: https://core.telegram.org/bots/api#sendvideonote Source: https://core.telegram.org/bots/api#sendvideonote
""" """
@ -21,30 +22,32 @@ class SendVideoNote(TelegramMethod[Message]):
__returning__ = Message __returning__ = Message
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
video_note: Union[InputFile, str] video_note: Union[InputFile, str]
"""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.. 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.. Sending
video notes by a URL is currently unsupported"""
duration: Optional[int] = None duration: Optional[int] = None
"""Duration of sent video in seconds""" """Duration of sent video in seconds"""
length: Optional[int] = None length: Optional[int] = None
"""Video width and height, i.e. diameter of the video message""" """Video width and height, i.e. diameter of the video message"""
thumb: Optional[Union[InputFile, str]] = None thumb: Optional[Union[InputFile, str]] = 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 thumbnails width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails cant 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>.""" """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 thumbnails width and height should not exceed 320. Ignored if the file is not uploaded
using multipart/form-data. Thumbnails cant 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>."""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = 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."""
reply_to_message_id: Optional[int] = None reply_to_message_id: Optional[int] = None
"""If the message is a reply, ID of the original message""" """If the message is a reply, ID of the original message"""
reply_markup: Optional[ reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None ] = None
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply
keyboard, instructions to remove reply keyboard or to force a reply from the user."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict( data: Dict[str, Any] = self.dict(

View file

@ -13,7 +13,11 @@ from .base import Request, TelegramMethod
class SendVoice(TelegramMethod[Message]): class SendVoice(TelegramMethod[Message]):
""" """
Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future. Use this method to send audio files, if you want Telegram clients to display the file as a
playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS
(other formats may be sent as Audio or Document). On success, the sent Message is returned.
Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in
the future.
Source: https://core.telegram.org/bots/api#sendvoice Source: https://core.telegram.org/bots/api#sendvoice
""" """
@ -21,30 +25,28 @@ class SendVoice(TelegramMethod[Message]):
__returning__ = Message __returning__ = Message
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
voice: Union[InputFile, str] voice: Union[InputFile, str]
"""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.""" """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."""
caption: Optional[str] = None caption: Optional[str] = None
"""Voice message caption, 0-1024 characters""" """Voice message caption, 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
duration: Optional[int] = None duration: Optional[int] = None
"""Duration of the voice message in seconds""" """Duration of the voice message in seconds"""
disable_notification: Optional[bool] = None disable_notification: Optional[bool] = 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."""
reply_to_message_id: Optional[int] = None reply_to_message_id: Optional[int] = None
"""If the message is a reply, ID of the original message""" """If the message is a reply, ID of the original message"""
reply_markup: Optional[ reply_markup: Optional[
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply] Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
] = None ] = None
"""Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.""" """Additional interface options. A JSON-serialized object for an inline keyboard, custom reply
keyboard, instructions to remove reply keyboard or to force a reply from the user."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict( data: Dict[str, Any] = self.dict(

View file

@ -5,7 +5,9 @@ from .base import Request, TelegramMethod
class SetChatDescription(TelegramMethod[bool]): class SetChatDescription(TelegramMethod[bool]):
""" """
Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. Use this method to change the description of a group, a supergroup or a channel. The bot must
be an administrator in the chat for this to work and must have the appropriate admin rights.
Returns True on success.
Source: https://core.telegram.org/bots/api#setchatdescription Source: https://core.telegram.org/bots/api#setchatdescription
""" """
@ -13,8 +15,8 @@ class SetChatDescription(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
description: Optional[str] = None description: Optional[str] = None
"""New chat description, 0-255 characters""" """New chat description, 0-255 characters"""

View file

@ -6,7 +6,9 @@ from .base import Request, TelegramMethod
class SetChatPermissions(TelegramMethod[bool]): class SetChatPermissions(TelegramMethod[bool]):
""" """
Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members admin rights. Returns True on success. Use this method to set default chat permissions for all members. The bot must be an
administrator in the group or a supergroup for this to work and must have the
can_restrict_members admin rights. Returns True on success.
Source: https://core.telegram.org/bots/api#setchatpermissions Source: https://core.telegram.org/bots/api#setchatpermissions
""" """
@ -14,8 +16,8 @@ class SetChatPermissions(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)""" """Unique identifier for the target chat or username of the target supergroup (in the format
@supergroupusername)"""
permissions: ChatPermissions permissions: ChatPermissions
"""New default chat permissions""" """New default chat permissions"""

View file

@ -6,7 +6,9 @@ from .base import Request, TelegramMethod
class SetChatPhoto(TelegramMethod[bool]): class SetChatPhoto(TelegramMethod[bool]):
""" """
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. Use this method to set a new profile photo for the chat. Photos can't be changed for private
chats. The bot must be an administrator in the chat for this to work and must have the
appropriate admin rights. Returns True on success.
Source: https://core.telegram.org/bots/api#setchatphoto Source: https://core.telegram.org/bots/api#setchatphoto
""" """
@ -14,8 +16,8 @@ class SetChatPhoto(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
photo: InputFile photo: InputFile
"""New chat photo, uploaded using multipart/form-data""" """New chat photo, uploaded using multipart/form-data"""

View file

@ -5,7 +5,10 @@ from .base import Request, TelegramMethod
class SetChatStickerSet(TelegramMethod[bool]): class SetChatStickerSet(TelegramMethod[bool]):
""" """
Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success. Use this method to set a new group sticker set for a supergroup. The bot must be an
administrator in the chat for this to work and must have the appropriate admin rights. Use the
field can_set_sticker_set optionally returned in getChat requests to check if the bot can use
this method. Returns True on success.
Source: https://core.telegram.org/bots/api#setchatstickerset Source: https://core.telegram.org/bots/api#setchatstickerset
""" """
@ -13,8 +16,8 @@ class SetChatStickerSet(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)""" """Unique identifier for the target chat or username of the target supergroup (in the format
@supergroupusername)"""
sticker_set_name: str sticker_set_name: str
"""Name of the sticker set to be set as the group sticker set""" """Name of the sticker set to be set as the group sticker set"""

View file

@ -5,7 +5,9 @@ from .base import Request, TelegramMethod
class SetChatTitle(TelegramMethod[bool]): class SetChatTitle(TelegramMethod[bool]):
""" """
Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. Use this method to change the title of a chat. Titles can't be changed for private chats. The
bot must be an administrator in the chat for this to work and must have the appropriate admin
rights. Returns True on success.
Source: https://core.telegram.org/bots/api#setchattitle Source: https://core.telegram.org/bots/api#setchattitle
""" """
@ -13,8 +15,8 @@ class SetChatTitle(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
title: str title: str
"""New chat title, 1-255 characters""" """New chat title, 1-255 characters"""

View file

@ -6,7 +6,9 @@ from .base import Request, TelegramMethod
class SetGameScore(TelegramMethod[Union[Message, bool]]): class SetGameScore(TelegramMethod[Union[Message, bool]]):
""" """
Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat and force is False. Use this method to set the score of the specified user in a game. On success, if the message
was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if
the new score is not greater than the user's current score in the chat and force is False.
Source: https://core.telegram.org/bots/api#setgamescore Source: https://core.telegram.org/bots/api#setgamescore
""" """
@ -15,22 +17,18 @@ class SetGameScore(TelegramMethod[Union[Message, bool]]):
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: Optional[bool] = None
"""Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters""" """Pass 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: Optional[bool] = None
"""Pass True, if the game message should not be automatically edited to include the current scoreboard""" """Pass True, if the game message should not be automatically edited to include the current
scoreboard"""
chat_id: Optional[int] = None chat_id: Optional[int] = 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: Optional[int] = 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: Optional[str] = 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"""

View file

@ -6,8 +6,13 @@ from .base import Request, TelegramMethod
class SetPassportDataErrors(TelegramMethod[bool]): class SetPassportDataErrors(TelegramMethod[bool]):
""" """
Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success. Informs a user that some of the Telegram Passport elements they provided contains errors. The
Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues. user will not be able to re-submit their Passport to you until the errors are fixed (the
contents of the field for which you returned the error must change). Returns True on success.
Use this if the data submitted by the user doesn't satisfy the standards your service requires
for any reason. For example, if a birthday date seems invalid, a submitted document is blurry,
a scan shows evidence of tampering, etc. Supply some details in the error message to make sure
the user knows how to correct the issues.
Source: https://core.telegram.org/bots/api#setpassportdataerrors Source: https://core.telegram.org/bots/api#setpassportdataerrors
""" """
@ -16,7 +21,6 @@ class SetPassportDataErrors(TelegramMethod[bool]):
user_id: int user_id: int
"""User identifier""" """User identifier"""
errors: List[PassportElementError] errors: List[PassportElementError]
"""A JSON-serialized array describing the errors""" """A JSON-serialized array describing the errors"""

View file

@ -5,7 +5,8 @@ from .base import Request, TelegramMethod
class SetStickerPositionInSet(TelegramMethod[bool]): class SetStickerPositionInSet(TelegramMethod[bool]):
""" """
Use this method to move a sticker in a set created by the bot to a specific position . Returns True on success. Use this method to move a sticker in a set created by the bot to a specific position . Returns
True on success.
Source: https://core.telegram.org/bots/api#setstickerpositioninset Source: https://core.telegram.org/bots/api#setstickerpositioninset
""" """
@ -14,7 +15,6 @@ class SetStickerPositionInSet(TelegramMethod[bool]):
sticker: str sticker: str
"""File identifier of the sticker""" """File identifier of the sticker"""
position: int position: int
"""New sticker position in the set, zero-based""" """New sticker position in the set, zero-based"""

View file

@ -6,13 +6,21 @@ from .base import Request, TelegramMethod
class SetWebhook(TelegramMethod[bool]): class SetWebhook(TelegramMethod[bool]):
""" """
Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts. Returns True on success. Use this method to specify a url and receive incoming updates via an outgoing webhook.
If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, e.g. https://www.example.com/<token>. Since nobody else knows your bots token, you can be pretty sure its us. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified
url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up
after a reasonable amount of attempts. Returns True on success.
If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a
secret path in the URL, e.g. https://www.example.com/<token>. Since nobody else knows your
bots token, you can be pretty sure its us.
Notes Notes
1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook is set up. 1. You will not be able to receive updates using getUpdates for as long as an outgoing webhook
2. To use a self-signed certificate, you need to upload your public key certificate using certificate parameter. Please upload as InputFile, sending a String will not work. is set up.
2. To use a self-signed certificate, you need to upload your public key certificate using
certificate parameter. Please upload as InputFile, sending a String will not work.
3. Ports currently supported for Webhooks: 443, 80, 88, 8443. 3. Ports currently supported for Webhooks: 443, 80, 88, 8443.
NEW! If you're having any trouble setting up webhooks, please check out this amazing guide to Webhooks. NEW! If you're having any trouble setting up webhooks, please check out this amazing guide to
Webhooks.
Source: https://core.telegram.org/bots/api#setwebhook Source: https://core.telegram.org/bots/api#setwebhook
""" """
@ -21,17 +29,18 @@ class SetWebhook(TelegramMethod[bool]):
url: str url: str
"""HTTPS url to send updates to. Use an empty string to remove webhook integration""" """HTTPS url to send updates to. Use an empty string to remove webhook integration"""
certificate: Optional[InputFile] = None certificate: Optional[InputFile] = None
"""Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details.""" """Upload your public key certificate so that the root certificate in use can be checked. See
our self-signed guide for details."""
max_connections: Optional[int] = None max_connections: Optional[int] = None
"""Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bots server, and higher values to increase your bots throughput.""" """Maximum allowed number of simultaneous HTTPS connections to the webhook for update
delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bots server,
and higher values to increase your bots throughput."""
allowed_updates: Optional[List[str]] = None allowed_updates: Optional[List[str]] = None
"""List the types of updates you want your bot to receive. For example, specify ['message', 'edited_channel_post', 'callback_query'] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used. """List the types of updates you want your bot to receive. For example, specify ['message',
'edited_channel_post', 'callback_query'] to only receive updates of these types. See Update
Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time.""" for a complete list of available update types. Specify an empty list to receive all updates
regardless of type (default). If not specified, the previous setting will be used."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict( data: Dict[str, Any] = self.dict(

View file

@ -6,7 +6,9 @@ from .base import Request, TelegramMethod
class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]): class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
""" """
Use this method to stop updating a live location message before live_period expires. On success, if the message was sent by the bot, the sent Message is returned, otherwise True is returned. Use this method to stop updating a live location message before live_period expires. On
success, if the message was sent by the bot, the sent Message is returned, otherwise True is
returned.
Source: https://core.telegram.org/bots/api#stopmessagelivelocation Source: https://core.telegram.org/bots/api#stopmessagelivelocation
""" """
@ -14,14 +16,13 @@ class StopMessageLiveLocation(TelegramMethod[Union[Message, bool]]):
__returning__ = Union[Message, bool] __returning__ = Union[Message, bool]
chat_id: Optional[Union[int, str]] = None chat_id: Optional[Union[int, str]] = None
"""Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Required if inline_message_id is not specified. Unique identifier for the target chat or
username of the target channel (in the format @channelusername)"""
message_id: Optional[int] = None message_id: Optional[int] = None
"""Required if inline_message_id is not specified. Identifier of the message with live location to stop""" """Required if inline_message_id is not specified. Identifier of the message with live
location to stop"""
inline_message_id: Optional[str] = None inline_message_id: Optional[str] = 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: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for a new inline keyboard.""" """A JSON-serialized object for a new inline keyboard."""

View file

@ -6,7 +6,8 @@ from .base import Request, TelegramMethod
class StopPoll(TelegramMethod[Poll]): class StopPoll(TelegramMethod[Poll]):
""" """
Use this method to stop a poll which was sent by the bot. On success, the stopped Poll with the final results is returned. Use this method to stop a poll which was sent by the bot. On success, the stopped Poll with
the final results is returned.
Source: https://core.telegram.org/bots/api#stoppoll Source: https://core.telegram.org/bots/api#stoppoll
""" """
@ -14,11 +15,10 @@ class StopPoll(TelegramMethod[Poll]):
__returning__ = Poll __returning__ = Poll
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
message_id: int message_id: int
"""Identifier of the original message with the poll""" """Identifier of the original message with the poll"""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""A JSON-serialized object for a new message inline keyboard.""" """A JSON-serialized object for a new message inline keyboard."""

View file

@ -5,7 +5,9 @@ from .base import Request, TelegramMethod
class UnbanChatMember(TelegramMethod[bool]): class UnbanChatMember(TelegramMethod[bool]):
""" """
Use this method to unban a previously kicked user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. Returns True on success. Use this method to unban a previously kicked user in a supergroup or channel. The user will
not return to the group or channel automatically, but will be able to join via link, etc. The
bot must be an administrator for this to work. Returns True on success.
Source: https://core.telegram.org/bots/api#unbanchatmember Source: https://core.telegram.org/bots/api#unbanchatmember
""" """
@ -13,8 +15,8 @@ class UnbanChatMember(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target group or username of the target supergroup or channel (in the format @username)""" """Unique identifier for the target group or username of the target supergroup or channel (in
the format @username)"""
user_id: int user_id: int
"""Unique identifier of the target user""" """Unique identifier of the target user"""

View file

@ -5,7 +5,9 @@ from .base import Request, TelegramMethod
class UnpinChatMessage(TelegramMethod[bool]): class UnpinChatMessage(TelegramMethod[bool]):
""" """
Use this method to unpin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the can_pin_messages admin right in the supergroup or can_edit_messages admin right in the channel. Returns True on success. Use this method to unpin a message in a group, a supergroup, or a channel. The bot must be an
administrator in the chat for this to work and must have the can_pin_messages admin right in
the supergroup or can_edit_messages admin right in the channel. Returns True on success.
Source: https://core.telegram.org/bots/api#unpinchatmessage Source: https://core.telegram.org/bots/api#unpinchatmessage
""" """
@ -13,7 +15,8 @@ class UnpinChatMessage(TelegramMethod[bool]):
__returning__ = bool __returning__ = bool
chat_id: Union[int, str] chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format @channelusername)""" """Unique identifier for the target chat or username of the target channel (in the format
@channelusername)"""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict() data: Dict[str, Any] = self.dict()

View file

@ -6,7 +6,8 @@ from .base import Request, TelegramMethod
class UploadStickerFile(TelegramMethod[File]): class UploadStickerFile(TelegramMethod[File]):
""" """
Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). Returns the uploaded File on success. Use this method to upload a .png file with a sticker for later use in createNewStickerSet and
addStickerToSet methods (can be used multiple times). Returns the uploaded File on success.
Source: https://core.telegram.org/bots/api#uploadstickerfile Source: https://core.telegram.org/bots/api#uploadstickerfile
""" """
@ -15,9 +16,9 @@ class UploadStickerFile(TelegramMethod[File]):
user_id: int user_id: int
"""User identifier of sticker file owner""" """User identifier of sticker file owner"""
png_sticker: InputFile png_sticker: InputFile
"""Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px.""" """Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed
512px, and either width or height must be exactly 512px."""
def build_request(self) -> Request: def build_request(self) -> Request:
data: Dict[str, Any] = self.dict( data: Dict[str, Any] = self.dict(

View file

@ -13,8 +13,15 @@ if TYPE_CHECKING:
class CallbackQuery(TelegramObject): class CallbackQuery(TelegramObject):
""" """
This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present. This object represents an incoming callback query from a callback button in an inline
NOTE: After the user presses a callback button, Telegram clients will display a progress bar until you call answerCallbackQuery. It is, therefore, necessary to react by calling answerCallbackQuery even if no notification to the user is needed (e.g., without specifying any of the optional parameters). keyboard. If the button that originated the query was attached to a message sent by the bot,
the field message will be present. If the button was attached to a message sent via the bot
(in inline mode), the field inline_message_id will be present. Exactly one of the fields data
or game_short_name will be present.
NOTE: After the user presses a callback button, Telegram clients will display a progress bar
until you call answerCallbackQuery. It is, therefore, necessary to react by calling
answerCallbackQuery even if no notification to the user is needed (e.g., without specifying
any of the optional parameters).
Source: https://core.telegram.org/bots/api#callbackquery Source: https://core.telegram.org/bots/api#callbackquery
""" """
@ -24,12 +31,15 @@ class CallbackQuery(TelegramObject):
from_user: User = Field(..., alias="from") from_user: User = Field(..., alias="from")
"""Sender""" """Sender"""
chat_instance: str chat_instance: str
"""Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games.""" """Global identifier, uniquely corresponding to the chat to which the message with the
callback button was sent. Useful for high scores in games."""
message: Optional[Message] = None message: Optional[Message] = None
"""Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old""" """Message with the callback button that originated the query. Note that message content and
message date will not be available if the message is too old"""
inline_message_id: Optional[str] = None inline_message_id: Optional[str] = None
"""Identifier of the message sent via the bot in inline mode, that originated the query.""" """Identifier of the message sent via the bot in inline mode, that originated the query."""
data: Optional[str] = None data: Optional[str] = None
"""Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field.""" """Data associated with the callback button. Be aware that a bad client can send arbitrary
data in this field."""
game_short_name: Optional[str] = None game_short_name: Optional[str] = None
"""Short name of a Game to be returned, serves as the unique identifier for the game""" """Short name of a Game to be returned, serves as the unique identifier for the game"""

View file

@ -5,8 +5,8 @@ from typing import TYPE_CHECKING, Optional
from .base import TelegramObject from .base import TelegramObject
if TYPE_CHECKING: if TYPE_CHECKING:
from .message import Message
from .chat_photo import ChatPhoto from .chat_photo import ChatPhoto
from .message import Message
from .chat_permissions import ChatPermissions from .chat_permissions import ChatPermissions
@ -18,7 +18,10 @@ class Chat(TelegramObject):
""" """
id: int id: int
"""Unique identifier for this chat. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.""" """Unique identifier for this chat. This number may be greater than 32 bits and some
programming languages may have difficulty/silent defects in interpreting it. But it is
smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe
for storing this identifier."""
type: str type: str
"""Type of chat, can be either 'private', 'group', 'supergroup' or 'channel'""" """Type of chat, can be either 'private', 'group', 'supergroup' or 'channel'"""
title: Optional[str] = None title: Optional[str] = None
@ -34,7 +37,9 @@ class Chat(TelegramObject):
description: Optional[str] = None description: Optional[str] = None
"""Description, for groups, supergroups and channel chats. Returned only in getChat.""" """Description, for groups, supergroups and channel chats. Returned only in getChat."""
invite_link: Optional[str] = None invite_link: Optional[str] = None
"""Chat invite link, for groups, supergroups and channel chats. Each administrator in a chat generates their own invite links, so the bot must first generate the link using exportChatInviteLink. Returned only in getChat.""" """Chat invite link, for groups, supergroups and channel chats. Each administrator in a chat
generates their own invite links, so the bot must first generate the link using
exportChatInviteLink. Returned only in getChat."""
pinned_message: Optional[Message] = None pinned_message: Optional[Message] = None
"""Pinned message, for groups, supergroups and channels. Returned only in getChat.""" """Pinned message, for groups, supergroups and channels. Returned only in getChat."""
permissions: Optional[ChatPermissions] = None permissions: Optional[ChatPermissions] = None

View file

@ -19,36 +19,47 @@ class ChatMember(TelegramObject):
user: User user: User
"""Information about the user""" """Information about the user"""
status: str status: str
"""The member's status in the chat. Can be 'creator', 'administrator', 'member', 'restricted', 'left' or 'kicked'""" """The member's status in the chat. Can be 'creator', 'administrator', 'member', 'restricted',
'left' or 'kicked'"""
until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None
"""Restricted and kicked only. Date when restrictions will be lifted for this user; unix time""" """Restricted and kicked only. Date when restrictions will be lifted for this user; unix time"""
can_be_edited: Optional[bool] = None can_be_edited: Optional[bool] = None
"""Administrators only. True, if the bot is allowed to edit administrator privileges of that user""" """Administrators only. True, if the bot is allowed to edit administrator privileges of that
user"""
can_post_messages: Optional[bool] = None can_post_messages: Optional[bool] = None
"""Administrators only. True, if the administrator can post in the channel; channels only""" """Administrators only. True, if the administrator can post in the channel; channels only"""
can_edit_messages: Optional[bool] = None can_edit_messages: Optional[bool] = None
"""Administrators only. True, if the administrator can edit messages of other users and can pin messages; channels only""" """Administrators only. True, if the administrator can edit messages of other users and can
pin messages; channels only"""
can_delete_messages: Optional[bool] = None can_delete_messages: Optional[bool] = None
"""Administrators only. True, if the administrator can delete messages of other users""" """Administrators only. True, if the administrator can delete messages of other users"""
can_restrict_members: Optional[bool] = None can_restrict_members: Optional[bool] = None
"""Administrators only. True, if the administrator can restrict, ban or unban chat members""" """Administrators only. True, if the administrator can restrict, ban or unban chat members"""
can_promote_members: Optional[bool] = None can_promote_members: Optional[bool] = None
"""Administrators only. True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user)""" """Administrators only. True, if the administrator can add new administrators with a subset of
his own privileges or demote administrators that he has promoted, directly or indirectly
(promoted by administrators that were appointed by the user)"""
can_change_info: Optional[bool] = None can_change_info: Optional[bool] = None
"""Administrators and restricted only. True, if the user is allowed to change the chat title, photo and other settings""" """Administrators and restricted only. True, if the user is allowed to change the chat title,
photo and other settings"""
can_invite_users: Optional[bool] = None can_invite_users: Optional[bool] = None
"""Administrators and restricted only. True, if the user is allowed to invite new users to the chat""" """Administrators and restricted only. True, if the user is allowed to invite new users to the
chat"""
can_pin_messages: Optional[bool] = None can_pin_messages: Optional[bool] = None
"""Administrators and restricted only. True, if the user is allowed to pin messages; groups and supergroups only""" """Administrators and restricted only. True, if the user is allowed to pin messages; groups
and supergroups only"""
is_member: Optional[bool] = None is_member: Optional[bool] = None
"""Restricted only. True, if the user is a member of the chat at the moment of the request""" """Restricted only. True, if the user is a member of the chat at the moment of the request"""
can_send_messages: Optional[bool] = None can_send_messages: Optional[bool] = None
"""Restricted only. True, if the user is allowed to send text messages, contacts, locations and venues""" """Restricted only. True, if the user is allowed to send text messages, contacts, locations
and venues"""
can_send_media_messages: Optional[bool] = None can_send_media_messages: Optional[bool] = None
"""Restricted only. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes""" """Restricted only. True, if the user is allowed to send audios, documents, photos, videos,
video notes and voice notes"""
can_send_polls: Optional[bool] = None can_send_polls: Optional[bool] = None
"""Restricted only. True, if the user is allowed to send polls""" """Restricted only. True, if the user is allowed to send polls"""
can_send_other_messages: Optional[bool] = None can_send_other_messages: Optional[bool] = None
"""Restricted only. True, if the user is allowed to send animations, games, stickers and use inline bots""" """Restricted only. True, if the user is allowed to send animations, games, stickers and use
inline bots"""
can_add_web_page_previews: Optional[bool] = None can_add_web_page_previews: Optional[bool] = None
"""Restricted only. True, if the user is allowed to add web page previews to their messages""" """Restricted only. True, if the user is allowed to add web page previews to their messages"""

View file

@ -15,15 +15,19 @@ class ChatPermissions(TelegramObject):
can_send_messages: Optional[bool] = None can_send_messages: Optional[bool] = None
"""True, if the user is allowed to send text messages, contacts, locations and venues""" """True, if the user is allowed to send text messages, contacts, locations and venues"""
can_send_media_messages: Optional[bool] = None can_send_media_messages: Optional[bool] = None
"""True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages""" """True, if the user is allowed to send audios, documents, photos, videos, video notes and
voice notes, implies can_send_messages"""
can_send_polls: Optional[bool] = None can_send_polls: Optional[bool] = None
"""True, if the user is allowed to send polls, implies can_send_messages""" """True, if the user is allowed to send polls, implies can_send_messages"""
can_send_other_messages: Optional[bool] = None can_send_other_messages: Optional[bool] = None
"""True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages""" """True, if the user is allowed to send animations, games, stickers and use inline bots,
implies can_send_media_messages"""
can_add_web_page_previews: Optional[bool] = None can_add_web_page_previews: Optional[bool] = None
"""True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages""" """True, if the user is allowed to add web page previews to their messages, implies
can_send_media_messages"""
can_change_info: Optional[bool] = None can_change_info: Optional[bool] = None
"""True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups""" """True, if the user is allowed to change the chat title, photo and other settings. Ignored in
public supergroups"""
can_invite_users: Optional[bool] = None can_invite_users: Optional[bool] = None
"""True, if the user is allowed to invite new users to the chat""" """True, if the user is allowed to invite new users to the chat"""
can_pin_messages: Optional[bool] = None can_pin_messages: Optional[bool] = None

View file

@ -11,6 +11,8 @@ class ChatPhoto(TelegramObject):
""" """
small_file_id: str small_file_id: str
"""File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.""" """File identifier of small (160x160) chat photo. This file_id can be used only for photo
download and only for as long as the photo is not changed."""
big_file_id: str big_file_id: str
"""File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.""" """File identifier of big (640x640) chat photo. This file_id can be used only for photo
download and only for as long as the photo is not changed."""

View file

@ -13,8 +13,10 @@ if TYPE_CHECKING:
class ChosenInlineResult(TelegramObject): class ChosenInlineResult(TelegramObject):
""" """
Represents a result of an inline query that was chosen by the user and sent to their chat partner. Represents a result of an inline query that was chosen by the user and sent to their chat
Note: It is necessary to enable inline feedback via @Botfather in order to receive these objects in updates. partner.
Note: It is necessary to enable inline feedback via @Botfather in order to receive these
objects in updates.
Source: https://core.telegram.org/bots/api#choseninlineresult Source: https://core.telegram.org/bots/api#choseninlineresult
""" """
@ -28,4 +30,6 @@ class ChosenInlineResult(TelegramObject):
location: Optional[Location] = None location: Optional[Location] = None
"""Sender location, only for bots that require user location""" """Sender location, only for bots that require user location"""
inline_message_id: Optional[str] = None inline_message_id: Optional[str] = None
"""Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message.""" """Identifier of the sent inline message. Available only if there is an inline keyboard
attached to the message. Will be also received in callback queries and can be used to edit
the message."""

View file

@ -5,14 +5,18 @@ from .base import TelegramObject
class EncryptedCredentials(TelegramObject): class EncryptedCredentials(TelegramObject):
""" """
Contains data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes. Contains data required for decrypting and authenticating EncryptedPassportElement. See the
Telegram Passport Documentation for a complete description of the data decryption and
authentication processes.
Source: https://core.telegram.org/bots/api#encryptedcredentials Source: https://core.telegram.org/bots/api#encryptedcredentials
""" """
data: str data: str
"""Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication""" """Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and
secrets required for EncryptedPassportElement decryption and authentication"""
hash: str hash: str
"""Base64-encoded data hash for data authentication""" """Base64-encoded data hash for data authentication"""
secret: str secret: str
"""Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption""" """Base64-encoded secret, encrypted with the bot's public RSA key, required for data
decryption"""

View file

@ -10,28 +10,45 @@ if TYPE_CHECKING:
class EncryptedPassportElement(TelegramObject): class EncryptedPassportElement(TelegramObject):
""" """
Contains information about documents or other Telegram Passport elements shared with the bot by the user. Contains information about documents or other Telegram Passport elements shared with the bot
by the user.
Source: https://core.telegram.org/bots/api#encryptedpassportelement Source: https://core.telegram.org/bots/api#encryptedpassportelement
""" """
type: str type: str
"""Element type. One of 'personal_details', 'passport', 'driver_license', 'identity_card', 'internal_passport', 'address', 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration', 'temporary_registration', 'phone_number', 'email'.""" """Element type. One of 'personal_details', 'passport', 'driver_license', 'identity_card',
'internal_passport', 'address', 'utility_bill', 'bank_statement', 'rental_agreement',
'passport_registration', 'temporary_registration', 'phone_number', 'email'."""
hash: str hash: str
"""Base64-encoded element hash for using in PassportElementErrorUnspecified""" """Base64-encoded element hash for using in PassportElementErrorUnspecified"""
data: Optional[str] = None data: Optional[str] = None
"""Base64-encoded encrypted Telegram Passport element data provided by the user, available for 'personal_details', 'passport', 'driver_license', 'identity_card', 'internal_passport' and 'address' types. Can be decrypted and verified using the accompanying EncryptedCredentials.""" """Base64-encoded encrypted Telegram Passport element data provided by the user, available for
'personal_details', 'passport', 'driver_license', 'identity_card', 'internal_passport' and
'address' types. Can be decrypted and verified using the accompanying EncryptedCredentials."""
phone_number: Optional[str] = None phone_number: Optional[str] = None
"""User's verified phone number, available only for 'phone_number' type""" """User's verified phone number, available only for 'phone_number' type"""
email: Optional[str] = None email: Optional[str] = None
"""User's verified email address, available only for 'email' type""" """User's verified email address, available only for 'email' type"""
files: Optional[List[PassportFile]] = None files: Optional[List[PassportFile]] = None
"""Array of encrypted files with documents provided by the user, available for 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration' and 'temporary_registration' types. Files can be decrypted and verified using the accompanying EncryptedCredentials.""" """Array of encrypted files with documents provided by the user, available for 'utility_bill',
'bank_statement', 'rental_agreement', 'passport_registration' and 'temporary_registration'
types. Files can be decrypted and verified using the accompanying EncryptedCredentials."""
front_side: Optional[PassportFile] = None front_side: Optional[PassportFile] = None
"""Encrypted file with the front side of the document, provided by the user. Available for 'passport', 'driver_license', 'identity_card' and 'internal_passport'. The file can be decrypted and verified using the accompanying EncryptedCredentials.""" """Encrypted file with the front side of the document, provided by the user. Available for
'passport', 'driver_license', 'identity_card' and 'internal_passport'. The file can be
decrypted and verified using the accompanying EncryptedCredentials."""
reverse_side: Optional[PassportFile] = None reverse_side: Optional[PassportFile] = None
"""Encrypted file with the reverse side of the document, provided by the user. Available for 'driver_license' and 'identity_card'. The file can be decrypted and verified using the accompanying EncryptedCredentials.""" """Encrypted file with the reverse side of the document, provided by the user. Available for
'driver_license' and 'identity_card'. The file can be decrypted and verified using the
accompanying EncryptedCredentials."""
selfie: Optional[PassportFile] = None selfie: Optional[PassportFile] = None
"""Encrypted file with the selfie of the user holding a document, provided by the user; available for 'passport', 'driver_license', 'identity_card' and 'internal_passport'. The file can be decrypted and verified using the accompanying EncryptedCredentials.""" """Encrypted file with the selfie of the user holding a document, provided by the user;
available for 'passport', 'driver_license', 'identity_card' and 'internal_passport'. The
file can be decrypted and verified using the accompanying EncryptedCredentials."""
translation: Optional[List[PassportFile]] = None translation: Optional[List[PassportFile]] = None
"""Array of encrypted files with translated versions of documents provided by the user. Available if requested for 'passport', 'driver_license', 'identity_card', 'internal_passport', 'utility_bill', 'bank_statement', 'rental_agreement', 'passport_registration' and 'temporary_registration' types. Files can be decrypted and verified using the accompanying EncryptedCredentials.""" """Array of encrypted files with translated versions of documents provided by the user.
Available if requested for 'passport', 'driver_license', 'identity_card',
'internal_passport', 'utility_bill', 'bank_statement', 'rental_agreement',
'passport_registration' and 'temporary_registration' types. Files can be decrypted and
verified using the accompanying EncryptedCredentials."""

View file

@ -7,7 +7,10 @@ from .base import TelegramObject
class File(TelegramObject): class File(TelegramObject):
""" """
This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile. This object represents a file ready to be downloaded. The file can be downloaded via the link
https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be
valid for at least 1 hour. When the link expires, a new one can be requested by calling
getFile.
Maximum file size to download is 20 MB Maximum file size to download is 20 MB
Source: https://core.telegram.org/bots/api#file Source: https://core.telegram.org/bots/api#file

View file

@ -7,17 +7,29 @@ from .base import TelegramObject
class ForceReply(TelegramObject): class ForceReply(TelegramObject):
""" """
Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bots message and tapped Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode. Upon receiving a message with this object, Telegram clients will display a reply interface to
Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions). There could be two ways to create a new poll: the user (act as if the user has selected the bots message and tapped Reply'). This can be
extremely useful if you want to create user-friendly step-by-step interfaces without having to
sacrifice privacy mode.
Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its
messages and mentions). There could be two ways to create a new poll:
Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2). May be appealing for hardcore users but lacks modern day polish. Explain the user how to send a command with parameters (e.g. /newpoll question answer1
Guide the user through a step-by-step process. Please send me your question, Cool, now lets add the first answer option, Great. Keep adding answer options, then send /done when youre ready. answer2). May be appealing for hardcore users but lacks modern day polish.
The last option is definitely more attractive. And if you use ForceReply in your bots questions, it will receive the users answers even if it only receives replies, commands and mentions without any extra work for the user. Guide the user through a step-by-step process. Please send me your question, Cool, now
lets add the first answer option, Great. Keep adding answer options, then send /done when
youre ready.
The last option is definitely more attractive. And if you use ForceReply in your bots
questions, it will receive the users answers even if it only receives replies, commands and
mentions without any extra work for the user.
Source: https://core.telegram.org/bots/api#forcereply Source: https://core.telegram.org/bots/api#forcereply
""" """
force_reply: bool force_reply: bool
"""Shows reply interface to the user, as if they manually selected the bots message and tapped Reply'""" """Shows reply interface to the user, as if they manually selected the bots message and
tapped Reply'"""
selective: Optional[bool] = None selective: Optional[bool] = None
"""Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.""" """Use this parameter if you want to force reply from specific users only. Targets: 1) users
that are @mentioned in the text of the Message object; 2) if the bot's message is a reply
(has reply_to_message_id), sender of the original message."""

View file

@ -12,7 +12,8 @@ if TYPE_CHECKING:
class Game(TelegramObject): class Game(TelegramObject):
""" """
This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers. This object represents a game. Use BotFather to create and edit games, their short names will
act as unique identifiers.
Source: https://core.telegram.org/bots/api#game Source: https://core.telegram.org/bots/api#game
""" """
@ -24,7 +25,9 @@ class Game(TelegramObject):
photo: List[PhotoSize] photo: List[PhotoSize]
"""Photo that will be displayed in the game message in chats.""" """Photo that will be displayed in the game message in chats."""
text: Optional[str] = None text: Optional[str] = None
"""Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.""" """Brief description of the game or high scores included in the game message. Can be
automatically edited to include current high scores for the game when the bot calls
setGameScore, or manually edited using editMessageText. 0-4096 characters."""
text_entities: Optional[List[MessageEntity]] = None text_entities: Optional[List[MessageEntity]] = None
"""Special entities that appear in text, such as usernames, URLs, bot commands, etc.""" """Special entities that appear in text, such as usernames, URLs, bot commands, etc."""
animation: Optional[Animation] = None animation: Optional[Animation] = None

View file

@ -5,13 +5,14 @@ from typing import TYPE_CHECKING, Optional
from .base import TelegramObject from .base import TelegramObject
if TYPE_CHECKING: if TYPE_CHECKING:
from .login_url import LoginUrl
from .callback_game import CallbackGame from .callback_game import CallbackGame
from .login_url import LoginUrl
class InlineKeyboardButton(TelegramObject): class InlineKeyboardButton(TelegramObject):
""" """
This object represents one button of an inline keyboard. You must use exactly one of the optional fields. This object represents one button of an inline keyboard. You must use exactly one of the
optional fields.
Source: https://core.telegram.org/bots/api#inlinekeyboardbutton Source: https://core.telegram.org/bots/api#inlinekeyboardbutton
""" """
@ -21,22 +22,19 @@ class InlineKeyboardButton(TelegramObject):
url: Optional[str] = None url: Optional[str] = None
"""HTTP or tg:// url to be opened when button is pressed""" """HTTP or tg:// url to be opened when button is pressed"""
login_url: Optional[LoginUrl] = None login_url: Optional[LoginUrl] = None
"""An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.""" """An HTTP URL used to automatically authorize the user. Can be used as a replacement for the
Telegram Login Widget."""
callback_data: Optional[str] = None callback_data: Optional[str] = None
"""Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes""" """Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes"""
switch_inline_query: Optional[str] = None switch_inline_query: Optional[str] = None
"""If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bots username and the specified inline query in the input field. Can be empty, in which case just the bots username will be inserted. """If set, pressing the button will prompt the user to select one of their chats, open that
chat and insert the bots username and the specified inline query in the input field. Can
Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm actions in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.""" be empty, in which case just the bots username will be inserted."""
switch_inline_query_current_chat: Optional[str] = None switch_inline_query_current_chat: Optional[str] = None
"""If set, pressing the button will insert the bots username and the specified inline query in the current chat's input field. Can be empty, in which case only the bots username will be inserted. """If set, pressing the button will insert the bots username and the specified inline query
in the current chat's input field. Can be empty, in which case only the bots username will
This offers a quick way for the user to open your bot in inline mode in the same chat good for selecting something from multiple options.""" be inserted."""
callback_game: Optional[CallbackGame] = None callback_game: Optional[CallbackGame] = None
"""Description of the game that will be launched when the user presses the button. """Description of the game that will be launched when the user presses the button."""
NOTE: This type of button must always be the first button in the first row."""
pay: Optional[bool] = None pay: Optional[bool] = None
"""Specify True, to send a Pay button. """Specify True, to send a Pay button."""
NOTE: This type of button must always be the first button in the first row."""

View file

@ -10,8 +10,10 @@ if TYPE_CHECKING:
class InlineKeyboardMarkup(TelegramObject): class InlineKeyboardMarkup(TelegramObject):
""" """
This object represents an inline keyboard that appears right next to the message it belongs to. This object represents an inline keyboard that appears right next to the message it belongs
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will display unsupported message. to.
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients
will display unsupported message.
Source: https://core.telegram.org/bots/api#inlinekeyboardmarkup Source: https://core.telegram.org/bots/api#inlinekeyboardmarkup
""" """

View file

@ -13,7 +13,8 @@ if TYPE_CHECKING:
class InlineQuery(TelegramObject): class InlineQuery(TelegramObject):
""" """
This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. This object represents an incoming inline query. When the user sends an empty query, your bot
could return some default or trending results.
Source: https://core.telegram.org/bots/api#inlinequery Source: https://core.telegram.org/bots/api#inlinequery
""" """

View file

@ -5,7 +5,8 @@ from .base import TelegramObject
class InlineQueryResult(TelegramObject): class InlineQueryResult(TelegramObject):
""" """
This object represents one result of an inline query. Telegram clients currently support results of the following 20 types: This object represents one result of an inline query. Telegram clients currently support
results of the following 20 types:
- InlineQueryResultCachedAudio - InlineQueryResultCachedAudio
- InlineQueryResultCachedDocument - InlineQueryResultCachedDocument
- InlineQueryResultCachedGif - InlineQueryResultCachedGif

View file

@ -7,8 +7,8 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultArticle(InlineQueryResult): class InlineQueryResultArticle(InlineQueryResult):

View file

@ -7,14 +7,17 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultAudio(InlineQueryResult): class InlineQueryResultAudio(InlineQueryResult):
""" """
Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio. Represents a link to an MP3 audio file. By default, this audio file will be sent by the user.
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. Alternatively, you can use input_message_content to send a message with the specified content
instead of the audio.
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients
will ignore them.
Source: https://core.telegram.org/bots/api#inlinequeryresultaudio Source: https://core.telegram.org/bots/api#inlinequeryresultaudio
""" """
@ -30,7 +33,8 @@ class InlineQueryResultAudio(InlineQueryResult):
caption: Optional[str] = None caption: Optional[str] = None
"""Caption, 0-1024 characters""" """Caption, 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
performer: Optional[str] = None performer: Optional[str] = None
"""Performer""" """Performer"""
audio_duration: Optional[int] = None audio_duration: Optional[int] = None

View file

@ -7,14 +7,17 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultCachedAudio(InlineQueryResult): class InlineQueryResultCachedAudio(InlineQueryResult):
""" """
Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio. Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. file will be sent by the user. Alternatively, you can use input_message_content to send a
message with the specified content instead of the audio.
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients
will ignore them.
Source: https://core.telegram.org/bots/api#inlinequeryresultcachedaudio Source: https://core.telegram.org/bots/api#inlinequeryresultcachedaudio
""" """
@ -28,7 +31,8 @@ class InlineQueryResultCachedAudio(InlineQueryResult):
caption: Optional[str] = None caption: Optional[str] = None
"""Caption, 0-1024 characters""" """Caption, 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""Inline keyboard attached to the message""" """Inline keyboard attached to the message"""
input_message_content: Optional[InputMessageContent] = None input_message_content: Optional[InputMessageContent] = None

View file

@ -7,14 +7,17 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultCachedDocument(InlineQueryResult): class InlineQueryResultCachedDocument(InlineQueryResult):
""" """
Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Represents a link to a file stored on the Telegram servers. By default, this file will be sent
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. by the user with an optional caption. Alternatively, you can use input_message_content to send
a message with the specified content instead of the file.
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients
will ignore them.
Source: https://core.telegram.org/bots/api#inlinequeryresultcacheddocument Source: https://core.telegram.org/bots/api#inlinequeryresultcacheddocument
""" """
@ -32,7 +35,8 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
caption: Optional[str] = None caption: Optional[str] = None
"""Caption of the document to be sent, 0-1024 characters""" """Caption of the document to be sent, 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""Inline keyboard attached to the message""" """Inline keyboard attached to the message"""
input_message_content: Optional[InputMessageContent] = None input_message_content: Optional[InputMessageContent] = None

View file

@ -7,13 +7,15 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultCachedGif(InlineQueryResult): class InlineQueryResultCachedGif(InlineQueryResult):
""" """
Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation. Represents a link to an animated GIF file stored on the Telegram servers. By default, this
animated GIF file will be sent by the user with an optional caption. Alternatively, you can
use input_message_content to send a message with specified content instead of the animation.
Source: https://core.telegram.org/bots/api#inlinequeryresultcachedgif Source: https://core.telegram.org/bots/api#inlinequeryresultcachedgif
""" """
@ -29,7 +31,8 @@ class InlineQueryResultCachedGif(InlineQueryResult):
caption: Optional[str] = None caption: Optional[str] = None
"""Caption of the GIF file to be sent, 0-1024 characters""" """Caption of the GIF file to be sent, 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""Inline keyboard attached to the message""" """Inline keyboard attached to the message"""
input_message_content: Optional[InputMessageContent] = None input_message_content: Optional[InputMessageContent] = None

View file

@ -7,13 +7,16 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultCachedMpeg4Gif(InlineQueryResult): class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
""" """
Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the
Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an
optional caption. Alternatively, you can use input_message_content to send a message with the
specified content instead of the animation.
Source: https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif Source: https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif
""" """
@ -29,7 +32,8 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
caption: Optional[str] = None caption: Optional[str] = None
"""Caption of the MPEG-4 file to be sent, 0-1024 characters""" """Caption of the MPEG-4 file to be sent, 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""Inline keyboard attached to the message""" """Inline keyboard attached to the message"""
input_message_content: Optional[InputMessageContent] = None input_message_content: Optional[InputMessageContent] = None

View file

@ -7,13 +7,15 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultCachedPhoto(InlineQueryResult): class InlineQueryResultCachedPhoto(InlineQueryResult):
""" """
Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. Represents a link to a photo stored on the Telegram servers. By default, this photo will be
sent by the user with an optional caption. Alternatively, you can use input_message_content to
send a message with the specified content instead of the photo.
Source: https://core.telegram.org/bots/api#inlinequeryresultcachedphoto Source: https://core.telegram.org/bots/api#inlinequeryresultcachedphoto
""" """
@ -31,7 +33,8 @@ class InlineQueryResultCachedPhoto(InlineQueryResult):
caption: Optional[str] = None caption: Optional[str] = None
"""Caption of the photo to be sent, 0-1024 characters""" """Caption of the photo to be sent, 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""Inline keyboard attached to the message""" """Inline keyboard attached to the message"""
input_message_content: Optional[InputMessageContent] = None input_message_content: Optional[InputMessageContent] = None

View file

@ -7,14 +7,17 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultCachedSticker(InlineQueryResult): class InlineQueryResultCachedSticker(InlineQueryResult):
""" """
Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker. Represents a link to a sticker stored on the Telegram servers. By default, this sticker will
Note: This will only work in Telegram versions released after 9 April, 2016 for static stickers and after 06 July, 2019 for animated stickers. Older clients will ignore them. be sent by the user. Alternatively, you can use input_message_content to send a message with
the specified content instead of the sticker.
Note: This will only work in Telegram versions released after 9 April, 2016 for static
stickers and after 06 July, 2019 for animated stickers. Older clients will ignore them.
Source: https://core.telegram.org/bots/api#inlinequeryresultcachedsticker Source: https://core.telegram.org/bots/api#inlinequeryresultcachedsticker
""" """

View file

@ -7,13 +7,15 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultCachedVideo(InlineQueryResult): class InlineQueryResultCachedVideo(InlineQueryResult):
""" """
Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video. Represents a link to a video file stored on the Telegram servers. By default, this video file
will be sent by the user with an optional caption. Alternatively, you can use
input_message_content to send a message with the specified content instead of the video.
Source: https://core.telegram.org/bots/api#inlinequeryresultcachedvideo Source: https://core.telegram.org/bots/api#inlinequeryresultcachedvideo
""" """
@ -31,7 +33,8 @@ class InlineQueryResultCachedVideo(InlineQueryResult):
caption: Optional[str] = None caption: Optional[str] = None
"""Caption of the video to be sent, 0-1024 characters""" """Caption of the video to be sent, 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""Inline keyboard attached to the message""" """Inline keyboard attached to the message"""
input_message_content: Optional[InputMessageContent] = None input_message_content: Optional[InputMessageContent] = None

View file

@ -7,14 +7,17 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultCachedVoice(InlineQueryResult): class InlineQueryResultCachedVoice(InlineQueryResult):
""" """
Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message. Represents a link to a voice message stored on the Telegram servers. By default, this voice
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. message will be sent by the user. Alternatively, you can use input_message_content to send a
message with the specified content instead of the voice message.
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients
will ignore them.
Source: https://core.telegram.org/bots/api#inlinequeryresultcachedvoice Source: https://core.telegram.org/bots/api#inlinequeryresultcachedvoice
""" """
@ -30,7 +33,8 @@ class InlineQueryResultCachedVoice(InlineQueryResult):
caption: Optional[str] = None caption: Optional[str] = None
"""Caption, 0-1024 characters""" """Caption, 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""Inline keyboard attached to the message""" """Inline keyboard attached to the message"""
input_message_content: Optional[InputMessageContent] = None input_message_content: Optional[InputMessageContent] = None

View file

@ -7,14 +7,17 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultContact(InlineQueryResult): class InlineQueryResultContact(InlineQueryResult):
""" """
Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact. Represents a contact with a phone number. By default, this contact will be sent by the user.
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. Alternatively, you can use input_message_content to send a message with the specified content
instead of the contact.
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients
will ignore them.
Source: https://core.telegram.org/bots/api#inlinequeryresultcontact Source: https://core.telegram.org/bots/api#inlinequeryresultcontact
""" """

View file

@ -7,14 +7,18 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultDocument(InlineQueryResult): class InlineQueryResultDocument(InlineQueryResult):
""" """
Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method. Represents a link to a file. By default, this file will be sent by the user with an optional
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. caption. Alternatively, you can use input_message_content to send a message with the specified
content instead of the file. Currently, only .PDF and .ZIP files can be sent using this
method.
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients
will ignore them.
Source: https://core.telegram.org/bots/api#inlinequeryresultdocument Source: https://core.telegram.org/bots/api#inlinequeryresultdocument
""" """
@ -32,7 +36,8 @@ class InlineQueryResultDocument(InlineQueryResult):
caption: Optional[str] = None caption: Optional[str] = None
"""Caption of the document to be sent, 0-1024 characters""" """Caption of the document to be sent, 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
description: Optional[str] = None description: Optional[str] = None
"""Short description of the result""" """Short description of the result"""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None

View file

@ -13,7 +13,8 @@ if TYPE_CHECKING:
class InlineQueryResultGame(InlineQueryResult): class InlineQueryResultGame(InlineQueryResult):
""" """
Represents a Game. Represents a Game.
Note: This will only work in Telegram versions released after October 1, 2016. Older clients will not display any inline results if a game result is among them. Note: This will only work in Telegram versions released after October 1, 2016. Older clients
will not display any inline results if a game result is among them.
Source: https://core.telegram.org/bots/api#inlinequeryresultgame Source: https://core.telegram.org/bots/api#inlinequeryresultgame
""" """

View file

@ -7,13 +7,15 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultGif(InlineQueryResult): class InlineQueryResultGif(InlineQueryResult):
""" """
Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. Represents a link to an animated GIF file. By default, this animated GIF file will be sent by
the user with optional caption. Alternatively, you can use input_message_content to send a
message with the specified content instead of the animation.
Source: https://core.telegram.org/bots/api#inlinequeryresultgif Source: https://core.telegram.org/bots/api#inlinequeryresultgif
""" """
@ -37,7 +39,8 @@ class InlineQueryResultGif(InlineQueryResult):
caption: Optional[str] = None caption: Optional[str] = None
"""Caption of the GIF file to be sent, 0-1024 characters""" """Caption of the GIF file to be sent, 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""Inline keyboard attached to the message""" """Inline keyboard attached to the message"""
input_message_content: Optional[InputMessageContent] = None input_message_content: Optional[InputMessageContent] = None

View file

@ -7,14 +7,17 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultLocation(InlineQueryResult): class InlineQueryResultLocation(InlineQueryResult):
""" """
Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location. Represents a location on a map. By default, the location will be sent by the user.
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. Alternatively, you can use input_message_content to send a message with the specified content
instead of the location.
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients
will ignore them.
Source: https://core.telegram.org/bots/api#inlinequeryresultlocation Source: https://core.telegram.org/bots/api#inlinequeryresultlocation
""" """

View file

@ -7,13 +7,16 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultMpeg4Gif(InlineQueryResult): class InlineQueryResultMpeg4Gif(InlineQueryResult):
""" """
Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation. Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default,
this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you
can use input_message_content to send a message with the specified content instead of the
animation.
Source: https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif Source: https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif
""" """
@ -37,7 +40,8 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
caption: Optional[str] = None caption: Optional[str] = None
"""Caption of the MPEG-4 file to be sent, 0-1024 characters""" """Caption of the MPEG-4 file to be sent, 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""Inline keyboard attached to the message""" """Inline keyboard attached to the message"""
input_message_content: Optional[InputMessageContent] = None input_message_content: Optional[InputMessageContent] = None

View file

@ -7,13 +7,15 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultPhoto(InlineQueryResult): class InlineQueryResultPhoto(InlineQueryResult):
""" """
Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo. Represents a link to a photo. By default, this photo will be sent by the user with optional
caption. Alternatively, you can use input_message_content to send a message with the specified
content instead of the photo.
Source: https://core.telegram.org/bots/api#inlinequeryresultphoto Source: https://core.telegram.org/bots/api#inlinequeryresultphoto
""" """
@ -37,7 +39,8 @@ class InlineQueryResultPhoto(InlineQueryResult):
caption: Optional[str] = None caption: Optional[str] = None
"""Caption of the photo to be sent, 0-1024 characters""" """Caption of the photo to be sent, 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""Inline keyboard attached to the message""" """Inline keyboard attached to the message"""
input_message_content: Optional[InputMessageContent] = None input_message_content: Optional[InputMessageContent] = None

View file

@ -7,14 +7,16 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultVenue(InlineQueryResult): class InlineQueryResultVenue(InlineQueryResult):
""" """
Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue. Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. input_message_content to send a message with the specified content instead of the venue.
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients
will ignore them.
Source: https://core.telegram.org/bots/api#inlinequeryresultvenue Source: https://core.telegram.org/bots/api#inlinequeryresultvenue
""" """
@ -34,7 +36,8 @@ class InlineQueryResultVenue(InlineQueryResult):
foursquare_id: Optional[str] = None foursquare_id: Optional[str] = None
"""Foursquare identifier of the venue if known""" """Foursquare identifier of the venue if known"""
foursquare_type: Optional[str] = None foursquare_type: Optional[str] = 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'.)"""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""Inline keyboard attached to the message""" """Inline keyboard attached to the message"""
input_message_content: Optional[InputMessageContent] = None input_message_content: Optional[InputMessageContent] = None

View file

@ -7,14 +7,17 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultVideo(InlineQueryResult): class InlineQueryResultVideo(InlineQueryResult):
""" """
Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video. Represents a link to a page containing an embedded video player or a video file. By default,
If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you must replace its content using input_message_content. this video file will be sent by the user with an optional caption. Alternatively, you can use
input_message_content to send a message with the specified content instead of the video.
If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you must
replace its content using input_message_content.
Source: https://core.telegram.org/bots/api#inlinequeryresultvideo Source: https://core.telegram.org/bots/api#inlinequeryresultvideo
""" """
@ -34,7 +37,8 @@ class InlineQueryResultVideo(InlineQueryResult):
caption: Optional[str] = None caption: Optional[str] = None
"""Caption of the video to be sent, 0-1024 characters""" """Caption of the video to be sent, 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
video_width: Optional[int] = None video_width: Optional[int] = None
"""Video width""" """Video width"""
video_height: Optional[int] = None video_height: Optional[int] = None
@ -46,4 +50,5 @@ class InlineQueryResultVideo(InlineQueryResult):
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None
"""Inline keyboard attached to the message""" """Inline keyboard attached to the message"""
input_message_content: Optional[InputMessageContent] = None input_message_content: Optional[InputMessageContent] = None
"""Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video).""" """Content of the message to be sent instead of the video. This field is required if
InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video)."""

View file

@ -7,14 +7,18 @@ from pydantic import Field
from .inline_query_result import InlineQueryResult from .inline_query_result import InlineQueryResult
if TYPE_CHECKING: if TYPE_CHECKING:
from .inline_keyboard_markup import InlineKeyboardMarkup
from .input_message_content import InputMessageContent from .input_message_content import InputMessageContent
from .inline_keyboard_markup import InlineKeyboardMarkup
class InlineQueryResultVoice(InlineQueryResult): class InlineQueryResultVoice(InlineQueryResult):
""" """
Represents a link to a voice recording in an .ogg container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message. Represents a link to a voice recording in an .ogg container encoded with OPUS. By default,
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. this voice recording will be sent by the user. Alternatively, you can use
input_message_content to send a message with the specified content instead of the the voice
message.
Note: This will only work in Telegram versions released after 9 April, 2016. Older clients
will ignore them.
Source: https://core.telegram.org/bots/api#inlinequeryresultvoice Source: https://core.telegram.org/bots/api#inlinequeryresultvoice
""" """
@ -30,7 +34,8 @@ class InlineQueryResultVoice(InlineQueryResult):
caption: Optional[str] = None caption: Optional[str] = None
"""Caption, 0-1024 characters""" """Caption, 0-1024 characters"""
parse_mode: Optional[str] = None parse_mode: Optional[str] = None
"""Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.""" """Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or
inline URLs in the media caption."""
voice_duration: Optional[int] = None voice_duration: Optional[int] = None
"""Recording duration in seconds""" """Recording duration in seconds"""
reply_markup: Optional[InlineKeyboardMarkup] = None reply_markup: Optional[InlineKeyboardMarkup] = None

View file

@ -13,7 +13,8 @@ DEFAULT_CHUNK_SIZE = 64 * 1024 # 64 kb
class InputFile(ABC): class InputFile(ABC):
""" """
This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser. This object represents the contents of a file to be uploaded. Must be posted using
multipart/form-data in the usual way that files are uploaded via the browser.
Source: https://core.telegram.org/bots/api#inputfile Source: https://core.telegram.org/bots/api#inputfile
""" """

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