mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Dev 3.x api 4.8 (#317)
* AIOG-T-20 Bot API 4.8 * AIOG-T-20 Update aliases * AIOG-T-20 Add parse mode passing in sendPoll method * AIOG-T-20 Small changes in docs * AIOG-T-20 Revert overriding remove keyboard default value and add tests * AIOG-T-20 Bot API 4.8
This commit is contained in:
parent
15bcc0ba9f
commit
6be0b36305
104 changed files with 312 additions and 175 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -9,6 +9,7 @@ dist/
|
|||
site/
|
||||
*.egg-info/
|
||||
*.egg
|
||||
aiogram/_meta.py
|
||||
|
||||
.mypy_cache
|
||||
.pytest_cache
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from ._meta import VERSION
|
||||
from .api import methods, types
|
||||
from .api.client import session
|
||||
from .api.client.bot import Bot
|
||||
|
|
@ -28,5 +29,5 @@ __all__ = (
|
|||
"handler",
|
||||
)
|
||||
|
||||
__version__ = "3.0.0a3"
|
||||
__api_version__ = "4.7"
|
||||
__version__ = VERSION
|
||||
__api_version__ = "4.8"
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
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.
|
||||
:param limit: Limits the number of updates to be retrieved. Values between 1—100 are
|
||||
:param limit: Limits the number of updates to be retrieved. Values between 1-100 are
|
||||
accepted. Defaults to 100.
|
||||
:param timeout: Timeout in seconds for long polling. Defaults to 0, i.e. usual short
|
||||
polling. Should be positive, short polling should be used for testing
|
||||
|
|
@ -355,8 +355,8 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param chat_id: Unique identifier for the target chat or username of the target channel
|
||||
(in the format @channelusername)
|
||||
:param text: Text of the message to be sent, 1-4096 characters after entities parsing
|
||||
:param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic,
|
||||
fixed-width text or inline URLs in your bot's message.
|
||||
:param parse_mode: Mode for parsing entities in the message text. See formatting options
|
||||
for more details.
|
||||
:param disable_web_page_preview: Disables link previews for links in this message
|
||||
:param disable_notification: Sends the message silently. Users will receive a notification
|
||||
with no sound.
|
||||
|
|
@ -431,8 +431,8 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
multipart/form-data.
|
||||
:param caption: Photo caption (may also be used when resending photos by file_id), 0-1024
|
||||
characters after entities parsing
|
||||
:param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic,
|
||||
fixed-width text or inline URLs in the media caption.
|
||||
:param parse_mode: Mode for parsing entities in the photo caption. See formatting options
|
||||
for more details.
|
||||
:param disable_notification: Sends the message silently. Users will receive a notification
|
||||
with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
|
|
@ -484,8 +484,8 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
for Telegram to get an audio file from the Internet, or upload a new one
|
||||
using multipart/form-data.
|
||||
:param caption: Audio caption, 0-1024 characters after entities parsing
|
||||
:param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic,
|
||||
fixed-width text or inline URLs in the media caption.
|
||||
:param parse_mode: Mode for parsing entities in the audio caption. See formatting options
|
||||
for more details.
|
||||
:param duration: Duration of the audio in seconds
|
||||
:param performer: Performer
|
||||
:param title: Track name
|
||||
|
|
@ -554,8 +554,8 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
multipart/form-data under <file_attach_name>.
|
||||
:param caption: Document caption (may also be used when resending documents by file_id),
|
||||
0-1024 characters after entities parsing
|
||||
:param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic,
|
||||
fixed-width text or inline URLs in the media caption.
|
||||
:param parse_mode: Mode for parsing entities in the document caption. See formatting
|
||||
options for more details.
|
||||
:param disable_notification: Sends the message silently. Users will receive a notification
|
||||
with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
|
|
@ -618,8 +618,8 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
multipart/form-data under <file_attach_name>.
|
||||
:param caption: Video caption (may also be used when resending videos by file_id), 0-1024
|
||||
characters after entities parsing
|
||||
:param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic,
|
||||
fixed-width text or inline URLs in the media caption.
|
||||
:param parse_mode: Mode for parsing entities in the video caption. See formatting options
|
||||
for more details.
|
||||
:param supports_streaming: Pass True, if the uploaded video is suitable for streaming
|
||||
:param disable_notification: Sends the message silently. Users will receive a notification
|
||||
with no sound.
|
||||
|
|
@ -686,8 +686,8 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
multipart/form-data under <file_attach_name>.
|
||||
:param caption: Animation caption (may also be used when resending animation by file_id),
|
||||
0-1024 characters after entities parsing
|
||||
:param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic,
|
||||
fixed-width text or inline URLs in the media caption.
|
||||
:param parse_mode: Mode for parsing entities in the animation caption. See formatting
|
||||
options for more details.
|
||||
:param disable_notification: Sends the message silently. Users will receive a notification
|
||||
with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
|
|
@ -740,8 +740,8 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
Telegram to get a file from the Internet, or upload a new one using
|
||||
multipart/form-data.
|
||||
:param caption: Voice message caption, 0-1024 characters after entities parsing
|
||||
:param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic,
|
||||
fixed-width text or inline URLs in the media caption.
|
||||
:param parse_mode: Mode for parsing entities in the voice message caption. See formatting
|
||||
options for more details.
|
||||
:param duration: Duration of the voice message in seconds
|
||||
:param disable_notification: Sends the message silently. Users will receive a notification
|
||||
with no sound.
|
||||
|
|
@ -833,7 +833,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param chat_id: Unique identifier for the target chat or username of the target channel
|
||||
(in the format @channelusername)
|
||||
:param media: A JSON-serialized array describing photos and videos to be sent, must
|
||||
include 2–10 items
|
||||
include 2-10 items
|
||||
:param disable_notification: Sends the messages silently. Users will receive a
|
||||
notification with no sound.
|
||||
:param reply_to_message_id: If the messages are a reply, ID of the original message
|
||||
|
|
@ -1068,6 +1068,10 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
type: Optional[str] = None,
|
||||
allows_multiple_answers: Optional[bool] = None,
|
||||
correct_option_id: Optional[int] = None,
|
||||
explanation: Optional[str] = None,
|
||||
explanation_parse_mode: Optional[str] = None,
|
||||
open_period: Optional[int] = None,
|
||||
close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
is_closed: Optional[bool] = None,
|
||||
disable_notification: Optional[bool] = None,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
|
|
@ -1091,6 +1095,16 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
polls in quiz mode, defaults to False
|
||||
:param correct_option_id: 0-based identifier of the correct answer option, required for
|
||||
polls in quiz mode
|
||||
:param explanation: Text that is shown when a user chooses an incorrect answer or taps on
|
||||
the lamp icon in a quiz-style poll, 0-200 characters with at most 2
|
||||
line feeds after entities parsing
|
||||
:param explanation_parse_mode: Mode for parsing entities in the explanation. See
|
||||
formatting options for more details.
|
||||
:param open_period: Amount of time in seconds the poll will be active after creation,
|
||||
5-600. Can't be used together with close_date.
|
||||
:param close_date: Point in time (Unix timestamp) when the poll will be automatically
|
||||
closed. Must be at least 5 and no more than 600 seconds in the future.
|
||||
Can't be used together with open_period.
|
||||
:param is_closed: Pass True, if the poll needs to be immediately closed. This can be
|
||||
useful for poll preview.
|
||||
:param disable_notification: Sends the message silently. Users will receive a notification
|
||||
|
|
@ -1109,6 +1123,10 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
type=type,
|
||||
allows_multiple_answers=allows_multiple_answers,
|
||||
correct_option_id=correct_option_id,
|
||||
explanation=explanation,
|
||||
explanation_parse_mode=explanation_parse_mode,
|
||||
open_period=open_period,
|
||||
close_date=close_date,
|
||||
is_closed=is_closed,
|
||||
disable_notification=disable_notification,
|
||||
reply_to_message_id=reply_to_message_id,
|
||||
|
|
@ -1119,6 +1137,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
async def send_dice(
|
||||
self,
|
||||
chat_id: Union[int, str],
|
||||
emoji: Optional[str] = None,
|
||||
disable_notification: Optional[bool] = None,
|
||||
reply_to_message_id: Optional[int] = None,
|
||||
reply_markup: Optional[
|
||||
|
|
@ -1134,6 +1153,8 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel
|
||||
(in the format @channelusername)
|
||||
:param emoji: Emoji on which the dice throw animation is based. Currently, must be one of
|
||||
'' or ''. Defauts to ''
|
||||
:param disable_notification: Sends the message silently. Users will receive a notification
|
||||
with no sound.
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
|
|
@ -1144,6 +1165,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
"""
|
||||
call = SendDice(
|
||||
chat_id=chat_id,
|
||||
emoji=emoji,
|
||||
disable_notification=disable_notification,
|
||||
reply_to_message_id=reply_to_message_id,
|
||||
reply_markup=reply_markup,
|
||||
|
|
@ -1188,7 +1210,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param user_id: Unique identifier of the target user
|
||||
:param offset: Sequential number of the first photo to be returned. By default, all photos
|
||||
are returned.
|
||||
:param limit: Limits the number of photos to be retrieved. Values between 1—100 are
|
||||
:param limit: Limits the number of photos to be retrieved. Values between 1-100 are
|
||||
accepted. Defaults to 100.
|
||||
:return: Returns a UserProfilePhotos object.
|
||||
"""
|
||||
|
|
@ -1218,7 +1240,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
self,
|
||||
chat_id: Union[int, str],
|
||||
user_id: int,
|
||||
until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None,
|
||||
until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to kick a user from a group, a supergroup or a channel. In the case of
|
||||
|
|
@ -1262,7 +1284,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
chat_id: Union[int, str],
|
||||
user_id: int,
|
||||
permissions: ChatPermissions,
|
||||
until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None,
|
||||
until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to restrict a user in a supergroup. The bot must be an administrator in
|
||||
|
|
@ -1322,7 +1344,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param can_pin_messages: Pass True, if the administrator can pin messages, supergroups
|
||||
only
|
||||
:param can_promote_members: Pass True, if the administrator can add new administrators
|
||||
with a subset of his own privileges or demote administrators
|
||||
with a subset of their own privileges or demote administrators
|
||||
that he has promoted, directly or indirectly (promoted by
|
||||
administrators that were appointed by him)
|
||||
:return: Returns True on success.
|
||||
|
|
@ -1387,7 +1409,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
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
|
||||
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.
|
||||
|
||||
|
|
@ -1644,7 +1666,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param show_alert: If true, an alert will be shown by the client instead of a notification
|
||||
at the top of the chat screen. Defaults to false.
|
||||
:param url: 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 –
|
||||
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.
|
||||
:param cache_time: The maximum amount of time in seconds that the result of the callback
|
||||
query may be cached client-side. Telegram apps will support caching
|
||||
|
|
@ -1714,8 +1736,8 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
message to edit
|
||||
:param inline_message_id: Required if chat_id and message_id are not specified. Identifier
|
||||
of the inline message
|
||||
:param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic,
|
||||
fixed-width text or inline URLs in your bot's message.
|
||||
:param parse_mode: Mode for parsing entities in the message text. See formatting options
|
||||
for more details.
|
||||
:param disable_web_page_preview: Disables link previews for links in this message
|
||||
:param reply_markup: A JSON-serialized object for an inline keyboard.
|
||||
:return: On success, if edited message is sent by the bot, the edited Message is returned,
|
||||
|
|
@ -1755,8 +1777,8 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
:param inline_message_id: Required if chat_id and message_id are not specified. Identifier
|
||||
of the inline message
|
||||
:param caption: New caption of the message, 0-1024 characters after entities parsing
|
||||
:param parse_mode: Send Markdown or HTML, if you want Telegram apps to show bold, italic,
|
||||
fixed-width text or inline URLs in the media caption.
|
||||
:param parse_mode: Mode for parsing entities in the message caption. See formatting
|
||||
options for more details.
|
||||
:param reply_markup: A JSON-serialized object for an inline keyboard.
|
||||
:return: On success, if edited message is sent by the bot, the edited Message is returned,
|
||||
otherwise True is returned.
|
||||
|
|
@ -1953,7 +1975,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
Source: https://core.telegram.org/bots/api#uploadstickerfile
|
||||
|
||||
:param user_id: User identifier of sticker file owner
|
||||
:param png_sticker: Png image with the sticker, must be up to 512 kilobytes in size,
|
||||
:param png_sticker: 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.
|
||||
:return: Returns the uploaded File on success.
|
||||
|
|
@ -2016,8 +2038,8 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
self,
|
||||
user_id: int,
|
||||
name: str,
|
||||
png_sticker: Union[InputFile, str],
|
||||
emojis: str,
|
||||
png_sticker: Optional[Union[InputFile, str]] = None,
|
||||
tgs_sticker: Optional[InputFile] = None,
|
||||
mask_position: Optional[MaskPosition] = None,
|
||||
) -> bool:
|
||||
|
|
@ -2031,13 +2053,13 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
|
||||
:param user_id: User identifier of sticker set owner
|
||||
:param name: Sticker set name
|
||||
:param emojis: One or more emoji corresponding to the sticker
|
||||
:param png_sticker: 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.
|
||||
:param emojis: One or more emoji corresponding to the sticker
|
||||
:param tgs_sticker: TGS animation with the sticker, uploaded using multipart/form-data.
|
||||
See https://core.telegram.org/animated_stickers#technical-requirements
|
||||
for technical requirements
|
||||
|
|
@ -2048,8 +2070,8 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
call = AddStickerToSet(
|
||||
user_id=user_id,
|
||||
name=name,
|
||||
png_sticker=png_sticker,
|
||||
emojis=emojis,
|
||||
png_sticker=png_sticker,
|
||||
tgs_sticker=tgs_sticker,
|
||||
mask_position=mask_position,
|
||||
)
|
||||
|
|
@ -2443,9 +2465,9 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
) -> 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.
|
||||
This method will currently return scores for the target user, plus two of his closest
|
||||
user and several of their 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 their 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.
|
||||
|
||||
|
|
@ -2458,11 +2480,11 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
message
|
||||
:param inline_message_id: Required if chat_id and message_id are not specified. Identifier
|
||||
of the inline message
|
||||
:return: Will return the score of the specified user and several of his neighbors in a
|
||||
:return: Will return the score of the specified user and several of their 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.
|
||||
currently return scores for the target user, plus two of their closest neighbors
|
||||
on each side. Will also return the top three users if the user and his neighbors
|
||||
are not among them.
|
||||
"""
|
||||
call = GetGameHighScores(
|
||||
user_id=user_id,
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ class AddStickerToSet(TelegramMethod[bool]):
|
|||
"""User identifier of sticker set owner"""
|
||||
name: str
|
||||
"""Sticker set name"""
|
||||
png_sticker: Union[InputFile, str]
|
||||
emojis: str
|
||||
"""One or more emoji corresponding to the sticker"""
|
||||
png_sticker: Optional[Union[InputFile, str]] = None
|
||||
"""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
|
||||
"""One or more emoji corresponding to the sticker"""
|
||||
tgs_sticker: Optional[InputFile] = None
|
||||
"""TGS animation with the sticker, uploaded using multipart/form-data. See
|
||||
https://core.telegram.org/animated_stickers#technical-requirements for technical
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class AnswerCallbackQuery(TelegramMethod[bool]):
|
|||
chat screen. Defaults to false."""
|
||||
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
|
||||
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."""
|
||||
cache_time: Optional[int] = None
|
||||
"""The maximum amount of time in seconds that the result of the callback query may be cached
|
||||
|
|
|
|||
|
|
@ -105,19 +105,19 @@ def prepare_media_file(data: Dict[str, Any], files: Dict[str, InputFile]) -> Non
|
|||
data["media"]["media"] = f"attach://{tag}"
|
||||
|
||||
|
||||
def prepare_parse_mode(root: Any) -> None:
|
||||
def prepare_parse_mode(root: Any, parse_mode_property: str = "parse_mode") -> None:
|
||||
if isinstance(root, list):
|
||||
for item in root:
|
||||
prepare_parse_mode(item)
|
||||
prepare_parse_mode(item, parse_mode_property=parse_mode_property)
|
||||
return
|
||||
|
||||
if root.get("parse_mode"):
|
||||
if root.get(parse_mode_property):
|
||||
return
|
||||
|
||||
from ..client.bot import Bot
|
||||
|
||||
bot = Bot.get_current(no_error=True)
|
||||
if bot and bot.parse_mode:
|
||||
root["parse_mode"] = bot.parse_mode
|
||||
root[parse_mode_property] = bot.parse_mode
|
||||
return
|
||||
return
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@ class EditMessageCaption(TelegramMethod[Union[Message, bool]]):
|
|||
caption: Optional[str] = None
|
||||
"""New caption of the message, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the message caption. See formatting options for more details."""
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||
"""A JSON-serialized object for an inline keyboard."""
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@ class EditMessageText(TelegramMethod[Union[Message, bool]]):
|
|||
inline_message_id: Optional[str] = None
|
||||
"""Required if chat_id and message_id are not specified. Identifier of the inline message"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the message text. See formatting options for more details."""
|
||||
disable_web_page_preview: Optional[bool] = None
|
||||
"""Disables link previews for links in this message"""
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class ExportChatInviteLink(TelegramMethod[str]):
|
|||
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
|
||||
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.
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ from .base import Request, TelegramMethod
|
|||
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.
|
||||
This method will currently return scores for the target user, plus two of his closest
|
||||
and several of their 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 their 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.
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class GetUpdates(TelegramMethod[List[Update]]):
|
|||
specified to retrieve updates starting from -offset update from the end of the updates
|
||||
queue. All previous updates will forgotten."""
|
||||
limit: Optional[int] = None
|
||||
"""Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults
|
||||
"""Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults
|
||||
to 100."""
|
||||
timeout: Optional[int] = None
|
||||
"""Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class GetUserProfilePhotos(TelegramMethod[UserProfilePhotos]):
|
|||
offset: Optional[int] = None
|
||||
"""Sequential number of the first photo to be returned. By default, all photos are returned."""
|
||||
limit: Optional[int] = None
|
||||
"""Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to
|
||||
"""Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to
|
||||
100."""
|
||||
|
||||
def build_request(self) -> Request:
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class KickChatMember(TelegramMethod[bool]):
|
|||
the format @channelusername)"""
|
||||
user_id: int
|
||||
"""Unique identifier of the target user"""
|
||||
until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None
|
||||
until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = 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"""
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class PromoteChatMember(TelegramMethod[bool]):
|
|||
can_pin_messages: Optional[bool] = None
|
||||
"""Pass True, if the administrator can pin messages, supergroups only"""
|
||||
can_promote_members: Optional[bool] = None
|
||||
"""Pass True, if the administrator can add new administrators with a subset of his own
|
||||
"""Pass True, if the administrator can add new administrators with a subset of their own
|
||||
privileges or demote administrators that he has promoted, directly or indirectly (promoted
|
||||
by administrators that were appointed by him)"""
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class RestrictChatMember(TelegramMethod[bool]):
|
|||
"""Unique identifier of the target user"""
|
||||
permissions: ChatPermissions
|
||||
"""New user permissions"""
|
||||
until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None
|
||||
until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = 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"""
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ class SendAnimation(TelegramMethod[Message]):
|
|||
"""Animation caption (may also be used when resending animation by file_id), 0-1024 characters
|
||||
after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the animation caption. See formatting options for more
|
||||
details."""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""Sends the message silently. Users will receive a notification with no sound."""
|
||||
reply_to_message_id: Optional[int] = None
|
||||
|
|
|
|||
|
|
@ -34,8 +34,7 @@ class SendAudio(TelegramMethod[Message]):
|
|||
caption: Optional[str] = None
|
||||
"""Audio caption, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the audio caption. See formatting options for more details."""
|
||||
duration: Optional[int] = None
|
||||
"""Duration of the audio in seconds"""
|
||||
performer: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ class SendDice(TelegramMethod[Message]):
|
|||
chat_id: Union[int, str]
|
||||
"""Unique identifier for the target chat or username of the target channel (in the format
|
||||
@channelusername)"""
|
||||
emoji: Optional[str] = None
|
||||
"""Emoji on which the dice throw animation is based. Currently, must be one of '' or ''.
|
||||
Defauts to ''"""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""Sends the message silently. Users will receive a notification with no sound."""
|
||||
reply_to_message_id: Optional[int] = None
|
||||
|
|
|
|||
|
|
@ -40,8 +40,7 @@ class SendDocument(TelegramMethod[Message]):
|
|||
"""Document caption (may also be used when resending documents by file_id), 0-1024 characters
|
||||
after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the document caption. See formatting options for more details."""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""Sends the message silently. Users will receive a notification with no sound."""
|
||||
reply_to_message_id: Optional[int] = None
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class SendMediaGroup(TelegramMethod[List[Message]]):
|
|||
"""Unique identifier for the target chat or username of the target channel (in the format
|
||||
@channelusername)"""
|
||||
media: List[Union[InputMediaPhoto, InputMediaVideo]]
|
||||
"""A JSON-serialized array describing photos and videos to be sent, must include 2–10 items"""
|
||||
"""A JSON-serialized array describing photos and videos to be sent, must include 2-10 items"""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""Sends the messages silently. Users will receive a notification with no sound."""
|
||||
reply_to_message_id: Optional[int] = None
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@ class SendMessage(TelegramMethod[Message]):
|
|||
text: str
|
||||
"""Text of the message to be sent, 1-4096 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the message text. See formatting options for more details."""
|
||||
disable_web_page_preview: Optional[bool] = None
|
||||
"""Disables link previews for links in this message"""
|
||||
disable_notification: Optional[bool] = None
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ class SendPhoto(TelegramMethod[Message]):
|
|||
"""Photo caption (may also be used when resending photos by file_id), 0-1024 characters after
|
||||
entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the photo caption. See formatting options for more details."""
|
||||
disable_notification: Optional[bool] = None
|
||||
"""Sends the message silently. Users will receive a notification with no sound."""
|
||||
reply_to_message_id: Optional[int] = None
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import datetime
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from ..types import (
|
||||
|
|
@ -7,7 +8,7 @@ from ..types import (
|
|||
ReplyKeyboardMarkup,
|
||||
ReplyKeyboardRemove,
|
||||
)
|
||||
from .base import Request, TelegramMethod
|
||||
from .base import Request, TelegramMethod, prepare_parse_mode
|
||||
|
||||
|
||||
class SendPoll(TelegramMethod[Message]):
|
||||
|
|
@ -35,6 +36,17 @@ class SendPoll(TelegramMethod[Message]):
|
|||
False"""
|
||||
correct_option_id: Optional[int] = None
|
||||
"""0-based identifier of the correct answer option, required for polls in quiz mode"""
|
||||
explanation: Optional[str] = None
|
||||
"""Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a
|
||||
quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing"""
|
||||
explanation_parse_mode: Optional[str] = None
|
||||
"""Mode for parsing entities in the explanation. See formatting options for more details."""
|
||||
open_period: Optional[int] = None
|
||||
"""Amount of time in seconds the poll will be active after creation, 5-600. Can't be used
|
||||
together with close_date."""
|
||||
close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
|
||||
"""Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least
|
||||
5 and no more than 600 seconds in the future. Can't be used together with open_period."""
|
||||
is_closed: Optional[bool] = None
|
||||
"""Pass True, if the poll needs to be immediately closed. This can be useful for poll preview."""
|
||||
disable_notification: Optional[bool] = None
|
||||
|
|
@ -49,5 +61,6 @@ class SendPoll(TelegramMethod[Message]):
|
|||
|
||||
def build_request(self) -> Request:
|
||||
data: Dict[str, Any] = self.dict()
|
||||
prepare_parse_mode(data, parse_mode_property="explanation_parse_mode")
|
||||
|
||||
return Request(method="sendPoll", data=data)
|
||||
|
|
|
|||
|
|
@ -46,8 +46,7 @@ class SendVideo(TelegramMethod[Message]):
|
|||
"""Video caption (may also be used when resending videos by file_id), 0-1024 characters after
|
||||
entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the video caption. See formatting options for more details."""
|
||||
supports_streaming: Optional[bool] = None
|
||||
"""Pass True, if the uploaded video is suitable for streaming"""
|
||||
disable_notification: Optional[bool] = None
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ class SendVoice(TelegramMethod[Message]):
|
|||
caption: Optional[str] = None
|
||||
"""Voice message caption, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the voice message caption. See formatting options for more
|
||||
details."""
|
||||
duration: Optional[int] = None
|
||||
"""Duration of the voice message in seconds"""
|
||||
disable_notification: Optional[bool] = None
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class UploadStickerFile(TelegramMethod[File]):
|
|||
user_id: int
|
||||
"""User identifier of sticker file owner"""
|
||||
png_sticker: InputFile
|
||||
"""Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed
|
||||
"""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:
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from .chat_permissions import ChatPermissions
|
|||
from .chat_photo import ChatPhoto
|
||||
from .chosen_inline_result import ChosenInlineResult
|
||||
from .contact import Contact
|
||||
from .dice import Dice
|
||||
from .dice import Dice, DiceEmoji
|
||||
from .document import Document
|
||||
from .encrypted_credentials import EncryptedCredentials
|
||||
from .encrypted_passport_element import EncryptedPassportElement
|
||||
|
|
@ -124,6 +124,7 @@ __all__ = (
|
|||
"PollAnswer",
|
||||
"Poll",
|
||||
"Dice",
|
||||
"DiceEmoji",
|
||||
"UserProfilePhotos",
|
||||
"File",
|
||||
"ReplyKeyboardMarkup",
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class ChatMember(TelegramObject):
|
|||
'left' or 'kicked'"""
|
||||
custom_title: Optional[str] = None
|
||||
"""Owner and administrators only. Custom title for this user"""
|
||||
until_date: Optional[Union[int, datetime.datetime, datetime.timedelta]] = None
|
||||
until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
|
||||
"""Restricted and kicked only. Date when restrictions will be lifted for this user; unix time"""
|
||||
can_be_edited: Optional[bool] = None
|
||||
"""Administrators only. True, if the bot is allowed to edit administrator privileges of that
|
||||
|
|
@ -39,7 +39,7 @@ class ChatMember(TelegramObject):
|
|||
"""Administrators only. True, if the administrator can restrict, ban or unban chat members"""
|
||||
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
|
||||
their 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
|
||||
"""Administrators and restricted only. True, if the user is allowed to change the chat title,
|
||||
|
|
|
|||
|
|
@ -5,11 +5,19 @@ from .base import TelegramObject
|
|||
|
||||
class Dice(TelegramObject):
|
||||
"""
|
||||
This object represents a dice with random value from 1 to 6. (Yes, we're aware of the 'proper'
|
||||
singular of die. But it's awkward, and we decided to help it change. One dice at a time!)
|
||||
This object represents a dice with a random value from 1 to 6 for currently supported base
|
||||
emoji. (Yes, we're aware of the 'proper' singular of die. But it's awkward, and we decided to
|
||||
help it change. One dice at a time!)
|
||||
|
||||
Source: https://core.telegram.org/bots/api#dice
|
||||
"""
|
||||
|
||||
emoji: str
|
||||
"""Emoji on which the dice throw animation is based"""
|
||||
value: int
|
||||
"""Value of the dice, 1-6"""
|
||||
"""Value of the dice, 1-6 for currently supported base emoji"""
|
||||
|
||||
|
||||
class DiceEmoji:
|
||||
DICE = "🎲"
|
||||
DART = "🎯"
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class InlineKeyboardButton(MutableTelegramObject):
|
|||
be empty, in which case just the bot’s username will be inserted."""
|
||||
switch_inline_query_current_chat: Optional[str] = None
|
||||
"""If set, pressing the button will insert the bot‘s username and the specified inline query
|
||||
in the current chat's input field. Can be empty, in which case only the bot’s username will
|
||||
in the current chat’s input field. Can be empty, in which case only the bot's username will
|
||||
be inserted."""
|
||||
callback_game: Optional[CallbackGame] = None
|
||||
"""Description of the game that will be launched when the user presses the button."""
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ class InlineQueryResultAudio(InlineQueryResult):
|
|||
caption: Optional[str] = None
|
||||
"""Caption, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the audio caption. See formatting options for more details."""
|
||||
performer: Optional[str] = None
|
||||
"""Performer"""
|
||||
audio_duration: Optional[int] = None
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ class InlineQueryResultCachedAudio(InlineQueryResult):
|
|||
caption: Optional[str] = None
|
||||
"""Caption, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the audio caption. See formatting options for more details."""
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||
"""Inline keyboard attached to the message"""
|
||||
input_message_content: Optional[InputMessageContent] = None
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@ class InlineQueryResultCachedDocument(InlineQueryResult):
|
|||
caption: Optional[str] = None
|
||||
"""Caption of the document to be sent, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the document caption. See formatting options for more details."""
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||
"""Inline keyboard attached to the message"""
|
||||
input_message_content: Optional[InputMessageContent] = None
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ class InlineQueryResultCachedGif(InlineQueryResult):
|
|||
caption: Optional[str] = None
|
||||
"""Caption of the GIF file to be sent, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the caption. See formatting options for more details."""
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||
"""Inline keyboard attached to the message"""
|
||||
input_message_content: Optional[InputMessageContent] = None
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ class InlineQueryResultCachedMpeg4Gif(InlineQueryResult):
|
|||
caption: Optional[str] = None
|
||||
"""Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the caption. See formatting options for more details."""
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||
"""Inline keyboard attached to the message"""
|
||||
input_message_content: Optional[InputMessageContent] = None
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ class InlineQueryResultCachedPhoto(InlineQueryResult):
|
|||
caption: Optional[str] = None
|
||||
"""Caption of the photo to be sent, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the photo caption. See formatting options for more details."""
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||
"""Inline keyboard attached to the message"""
|
||||
input_message_content: Optional[InputMessageContent] = None
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ class InlineQueryResultCachedVideo(InlineQueryResult):
|
|||
caption: Optional[str] = None
|
||||
"""Caption of the video to be sent, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the video caption. See formatting options for more details."""
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||
"""Inline keyboard attached to the message"""
|
||||
input_message_content: Optional[InputMessageContent] = None
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ class InlineQueryResultCachedVoice(InlineQueryResult):
|
|||
caption: Optional[str] = None
|
||||
"""Caption, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the voice message caption. See formatting options for more
|
||||
details."""
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||
"""Inline keyboard attached to the message"""
|
||||
input_message_content: Optional[InputMessageContent] = None
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ class InlineQueryResultDocument(InlineQueryResult):
|
|||
caption: Optional[str] = None
|
||||
"""Caption of the document to be sent, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the document caption. See formatting options for more details."""
|
||||
description: Optional[str] = None
|
||||
"""Short description of the result"""
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||
|
|
|
|||
|
|
@ -39,8 +39,7 @@ class InlineQueryResultGif(InlineQueryResult):
|
|||
caption: Optional[str] = None
|
||||
"""Caption of the GIF file to be sent, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the caption. See formatting options for more details."""
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||
"""Inline keyboard attached to the message"""
|
||||
input_message_content: Optional[InputMessageContent] = None
|
||||
|
|
|
|||
|
|
@ -40,8 +40,7 @@ class InlineQueryResultMpeg4Gif(InlineQueryResult):
|
|||
caption: Optional[str] = None
|
||||
"""Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the caption. See formatting options for more details."""
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||
"""Inline keyboard attached to the message"""
|
||||
input_message_content: Optional[InputMessageContent] = None
|
||||
|
|
|
|||
|
|
@ -39,8 +39,7 @@ class InlineQueryResultPhoto(InlineQueryResult):
|
|||
caption: Optional[str] = None
|
||||
"""Caption of the photo to be sent, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the photo caption. See formatting options for more details."""
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||
"""Inline keyboard attached to the message"""
|
||||
input_message_content: Optional[InputMessageContent] = None
|
||||
|
|
|
|||
|
|
@ -37,8 +37,7 @@ class InlineQueryResultVideo(InlineQueryResult):
|
|||
caption: Optional[str] = None
|
||||
"""Caption of the video to be sent, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the video caption. See formatting options for more details."""
|
||||
video_width: Optional[int] = None
|
||||
"""Video width"""
|
||||
video_height: Optional[int] = None
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ class InlineQueryResultVoice(InlineQueryResult):
|
|||
caption: Optional[str] = None
|
||||
"""Caption, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the voice message caption. See formatting options for more
|
||||
details."""
|
||||
voice_duration: Optional[int] = None
|
||||
"""Recording duration in seconds"""
|
||||
reply_markup: Optional[InlineKeyboardMarkup] = None
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ class InputMediaAnimation(InputMedia):
|
|||
caption: Optional[str] = None
|
||||
"""Caption of the animation to be sent, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the animation caption. See formatting options for more
|
||||
details."""
|
||||
width: Optional[int] = None
|
||||
"""Animation width"""
|
||||
height: Optional[int] = None
|
||||
|
|
|
|||
|
|
@ -34,8 +34,7 @@ class InputMediaAudio(InputMedia):
|
|||
caption: Optional[str] = None
|
||||
"""Caption of the audio to be sent, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the audio caption. See formatting options for more details."""
|
||||
duration: Optional[int] = None
|
||||
"""Duration of the audio in seconds"""
|
||||
performer: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -34,5 +34,4 @@ class InputMediaDocument(InputMedia):
|
|||
caption: Optional[str] = None
|
||||
"""Caption of the document to be sent, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the document caption. See formatting options for more details."""
|
||||
|
|
|
|||
|
|
@ -27,5 +27,4 @@ class InputMediaPhoto(InputMedia):
|
|||
caption: Optional[str] = None
|
||||
"""Caption of the photo to be sent, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the photo caption. See formatting options for more details."""
|
||||
|
|
|
|||
|
|
@ -34,8 +34,7 @@ class InputMediaVideo(InputMedia):
|
|||
caption: Optional[str] = None
|
||||
"""Caption of the video to be sent, 0-1024 characters after entities parsing"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the video caption. See formatting options for more details."""
|
||||
width: Optional[int] = None
|
||||
"""Video width"""
|
||||
height: Optional[int] = None
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ class InputTextMessageContent(InputMessageContent):
|
|||
message_text: str
|
||||
"""Text of the message to be sent, 1-4096 characters"""
|
||||
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."""
|
||||
"""Mode for parsing entities in the message text. See formatting options for more details."""
|
||||
disable_web_page_preview: Optional[bool] = None
|
||||
"""Disables link previews for links in the sent message"""
|
||||
|
|
|
|||
|
|
@ -1007,6 +1007,10 @@ class Message(TelegramObject):
|
|||
type: Optional[str] = None,
|
||||
allows_multiple_answers: Optional[bool] = None,
|
||||
correct_option_id: Optional[int] = None,
|
||||
explanation: Optional[str] = None,
|
||||
explanation_parse_mode: Optional[str] = None,
|
||||
open_period: Optional[int] = None,
|
||||
close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
is_closed: Optional[bool] = None,
|
||||
disable_notification: Optional[bool] = None,
|
||||
reply_markup: Optional[
|
||||
|
|
@ -1022,6 +1026,10 @@ class Message(TelegramObject):
|
|||
:param type:
|
||||
:param allows_multiple_answers:
|
||||
:param correct_option_id:
|
||||
:param explanation:
|
||||
:param explanation_parse_mode:
|
||||
:param open_period:
|
||||
:param close_date:
|
||||
:param is_closed:
|
||||
:param disable_notification:
|
||||
:param reply_markup:
|
||||
|
|
@ -1037,6 +1045,10 @@ class Message(TelegramObject):
|
|||
type=type,
|
||||
allows_multiple_answers=allows_multiple_answers,
|
||||
correct_option_id=correct_option_id,
|
||||
explanation=explanation,
|
||||
explanation_parse_mode=explanation_parse_mode,
|
||||
open_period=open_period,
|
||||
close_date=close_date,
|
||||
is_closed=is_closed,
|
||||
disable_notification=disable_notification,
|
||||
reply_to_message_id=self.message_id,
|
||||
|
|
@ -1051,6 +1063,10 @@ class Message(TelegramObject):
|
|||
type: Optional[str] = None,
|
||||
allows_multiple_answers: Optional[bool] = None,
|
||||
correct_option_id: Optional[int] = None,
|
||||
explanation: Optional[str] = None,
|
||||
explanation_parse_mode: Optional[str] = None,
|
||||
open_period: Optional[int] = None,
|
||||
close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
is_closed: Optional[bool] = None,
|
||||
disable_notification: Optional[bool] = None,
|
||||
reply_markup: Optional[
|
||||
|
|
@ -1066,6 +1082,10 @@ class Message(TelegramObject):
|
|||
:param type:
|
||||
:param allows_multiple_answers:
|
||||
:param correct_option_id:
|
||||
:param explanation:
|
||||
:param explanation_parse_mode:
|
||||
:param open_period:
|
||||
:param close_date:
|
||||
:param is_closed:
|
||||
:param disable_notification:
|
||||
:param reply_markup:
|
||||
|
|
@ -1081,6 +1101,10 @@ class Message(TelegramObject):
|
|||
type=type,
|
||||
allows_multiple_answers=allows_multiple_answers,
|
||||
correct_option_id=correct_option_id,
|
||||
explanation=explanation,
|
||||
explanation_parse_mode=explanation_parse_mode,
|
||||
open_period=open_period,
|
||||
close_date=close_date,
|
||||
is_closed=is_closed,
|
||||
disable_notification=disable_notification,
|
||||
reply_to_message_id=None,
|
||||
|
|
@ -1089,6 +1113,7 @@ class Message(TelegramObject):
|
|||
|
||||
def reply_dice(
|
||||
self,
|
||||
emoji: Optional[str] = None,
|
||||
disable_notification: Optional[bool] = None,
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
|
|
@ -1097,6 +1122,7 @@ class Message(TelegramObject):
|
|||
"""
|
||||
Reply with dice
|
||||
|
||||
:param emoji:
|
||||
:param disable_notification:
|
||||
:param reply_markup:
|
||||
:return:
|
||||
|
|
@ -1105,6 +1131,7 @@ class Message(TelegramObject):
|
|||
|
||||
return SendDice(
|
||||
chat_id=self.chat.id,
|
||||
emoji=emoji,
|
||||
disable_notification=disable_notification,
|
||||
reply_to_message_id=self.message_id,
|
||||
reply_markup=reply_markup,
|
||||
|
|
@ -1112,6 +1139,7 @@ class Message(TelegramObject):
|
|||
|
||||
def answer_dice(
|
||||
self,
|
||||
emoji: Optional[str] = None,
|
||||
disable_notification: Optional[bool] = None,
|
||||
reply_markup: Optional[
|
||||
Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]
|
||||
|
|
@ -1120,6 +1148,7 @@ class Message(TelegramObject):
|
|||
"""
|
||||
Answer with dice
|
||||
|
||||
:param emoji:
|
||||
:param disable_notification:
|
||||
:param reply_markup:
|
||||
:return:
|
||||
|
|
@ -1128,6 +1157,7 @@ class Message(TelegramObject):
|
|||
|
||||
return SendDice(
|
||||
chat_id=self.chat.id,
|
||||
emoji=emoji,
|
||||
disable_notification=disable_notification,
|
||||
reply_to_message_id=None,
|
||||
reply_markup=reply_markup,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, List, Optional
|
||||
import datetime
|
||||
from typing import TYPE_CHECKING, List, Optional, Union
|
||||
|
||||
from .base import TelegramObject
|
||||
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
from .message_entity import MessageEntity
|
||||
from .poll_option import PollOption
|
||||
|
||||
|
||||
|
|
@ -35,3 +37,12 @@ class Poll(TelegramObject):
|
|||
"""0-based identifier of the correct answer option. Available only for polls in the quiz mode,
|
||||
which are closed, or was sent (not forwarded) by the bot or to the private chat with the
|
||||
bot."""
|
||||
explanation: Optional[str] = None
|
||||
"""Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a
|
||||
quiz-style poll, 0-200 characters"""
|
||||
explanation_entities: Optional[List[MessageEntity]] = None
|
||||
"""Special entities like usernames, URLs, bot commands, etc. that appear in the explanation"""
|
||||
open_period: Optional[int] = None
|
||||
"""Amount of time in seconds the poll will be active after creation"""
|
||||
close_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
|
||||
"""Point in time (Unix timestamp) when the poll will be automatically closed"""
|
||||
|
|
|
|||
18
build.py
Normal file
18
build.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
from pathlib import Path
|
||||
from typing import Any, Dict
|
||||
|
||||
BUILD_PATH: Path = Path(__file__).parent
|
||||
META_PATH: Path = BUILD_PATH / "aiogram" / "_meta.py"
|
||||
|
||||
|
||||
def write_metadata(setup_kwargs: Dict[str, Any]) -> None:
|
||||
version = setup_kwargs["version"]
|
||||
description = setup_kwargs["description"]
|
||||
|
||||
content = [f"VERSION = {version!r}", f"DESCRIPTION = {description!r}"]
|
||||
|
||||
META_PATH.write_text("\n".join(content + [""]))
|
||||
|
||||
|
||||
def build(setup_kwargs: Dict[str, Any]):
|
||||
write_metadata(setup_kwargs)
|
||||
|
|
@ -1 +1 @@
|
|||
4.7
|
||||
4.8
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Full list of methods can be found in section "[Methods](methods/index.md)"
|
|||
All types is also wrapped with [pydantic](https://pydantic-docs.helpmanual.io/) and placed in `aiogram.api.types` package.
|
||||
In this place makes some more differences with official documentations:
|
||||
|
||||
- name `from` was renamed to `from_user` in due to `from` is an keyword in python
|
||||
- name `from` was renamed to `from_user` in due to `from` is an [keyword in python](https://docs.python.org/3/reference/lexical_analysis.html#keywords)
|
||||
- timestamps has `datetime.datetime` type instead of `int`
|
||||
- InputFile is used for sending files and is not use `pydantic.BaseModel` as base class
|
||||
|
||||
|
|
@ -37,3 +37,23 @@ Constructor specification:
|
|||
| `parse_mode` | `#!python3 Optional[str]` | Default parse mode. If specified it will be propagated into the API methods at runtime. |
|
||||
|
||||
This class has aliases for all API methods and named in `lower_camel_case`. For example `sendMessage` named `send_message` and has the same specification with all class-based methods.
|
||||
|
||||
Here you can pass default parse mode (argument `parse_mode`) and this value will be used in all API methods automatically.
|
||||
|
||||
|
||||
## Usage
|
||||
```python3
|
||||
import asyncio
|
||||
from os import getenv
|
||||
|
||||
from aiogram import Bot
|
||||
|
||||
|
||||
async def main():
|
||||
async with Bot(token=getenv("TELEGRAM_TOKEN"), parse_mode="HTML").context() as bot:
|
||||
await bot.send_message(61043901, "<b>Hello, World!</b>")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
```
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ Use this method to add a new sticker to a set created by the bot. You must use e
|
|||
| - | - | - |
|
||||
| `user_id` | `#!python3 int` | User identifier of sticker set owner |
|
||||
| `name` | `#!python3 str` | Sticker set name |
|
||||
| `png_sticker` | `#!python3 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. |
|
||||
| `emojis` | `#!python3 str` | One or more emoji corresponding to the sticker |
|
||||
| `png_sticker` | `#!python3 Optional[Union[InputFile, str]]` | Optional. 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. |
|
||||
| `tgs_sticker` | `#!python3 Optional[InputFile]` | Optional. TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements |
|
||||
| `mask_position` | `#!python3 Optional[MaskPosition]` | Optional. A JSON-serialized object for position where the mask should be placed on faces |
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Alternatively, the user can be redirected to the specified Game URL. For this op
|
|||
| `callback_query_id` | `#!python3 str` | Unique identifier for the query to be answered |
|
||||
| `text` | `#!python3 Optional[str]` | Optional. Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters |
|
||||
| `show_alert` | `#!python3 Optional[bool]` | Optional. 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` | `#!python3 Optional[str]` | Optional. 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` | `#!python3 Optional[str]` | Optional. 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. |
|
||||
| `cache_time` | `#!python3 Optional[int]` | Optional. 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. |
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Use this method to edit captions of messages. On success, if edited message is s
|
|||
| `message_id` | `#!python3 Optional[int]` | Optional. Required if inline_message_id is not specified. Identifier of the message to edit |
|
||||
| `inline_message_id` | `#!python3 Optional[str]` | Optional. Required if chat_id and message_id are not specified. Identifier of the inline message |
|
||||
| `caption` | `#!python3 Optional[str]` | Optional. New caption of the message, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the message caption. See formatting options for more details. |
|
||||
| `reply_markup` | `#!python3 Optional[InlineKeyboardMarkup]` | Optional. A JSON-serialized object for an inline keyboard. |
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Use this method to edit text and game messages. On success, if edited message is
|
|||
| `chat_id` | `#!python3 Optional[Union[int, str]]` | Optional. 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` | `#!python3 Optional[int]` | Optional. Required if inline_message_id is not specified. Identifier of the message to edit |
|
||||
| `inline_message_id` | `#!python3 Optional[str]` | Optional. Required if chat_id and message_id are not specified. Identifier of the inline message |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the message text. See formatting options for more details. |
|
||||
| `disable_web_page_preview` | `#!python3 Optional[bool]` | Optional. Disables link previews for links in this message |
|
||||
| `reply_markup` | `#!python3 Optional[InlineKeyboardMarkup]` | Optional. A JSON-serialized object for an inline keyboard. |
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
|
||||
## Arguments
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
## Description
|
||||
|
||||
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 and several of their 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.
|
||||
This method will currently return scores for the target user, plus two of their 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.
|
||||
|
||||
|
||||
## Arguments
|
||||
|
|
@ -22,7 +22,7 @@ This method will currently return scores for the target user, plus two of his cl
|
|||
|
||||
Type: `#!python3 List[GameHighScore]`
|
||||
|
||||
Description: Will return the score of the specified user 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.
|
||||
Description: Will return the score of the specified user and several of their 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 their closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them.
|
||||
|
||||
|
||||
## Usage
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Notes
|
|||
| Name | Type | Description |
|
||||
| - | - | - |
|
||||
| `offset` | `#!python3 Optional[int]` | Optional. 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` | `#!python3 Optional[int]` | Optional. Limits the number of updates to be retrieved. Values between 1—100 are accepted. Defaults to 100. |
|
||||
| `limit` | `#!python3 Optional[int]` | Optional. Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100. |
|
||||
| `timeout` | `#!python3 Optional[int]` | Optional. 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` | `#!python3 Optional[List[str]]` | Optional. A JSON-serialized list of the update types 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. |
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Use this method to get a list of profile pictures for a user. Returns a UserProf
|
|||
| - | - | - |
|
||||
| `user_id` | `#!python3 int` | Unique identifier of the target user |
|
||||
| `offset` | `#!python3 Optional[int]` | Optional. Sequential number of the first photo to be returned. By default, all photos are returned. |
|
||||
| `limit` | `#!python3 Optional[int]` | Optional. Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100. |
|
||||
| `limit` | `#!python3 Optional[int]` | Optional. Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100. |
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Use this method to kick a user from a group, a supergroup or a channel. In the c
|
|||
| - | - | - |
|
||||
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername) |
|
||||
| `user_id` | `#!python3 int` | Unique identifier of the target user |
|
||||
| `until_date` | `#!python3 Optional[Union[int, datetime.datetime, datetime.timedelta]]` | Optional. 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 |
|
||||
| `until_date` | `#!python3 Optional[Union[datetime.datetime, datetime.timedelta, int]]` | Optional. 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 |
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Use this method to promote or demote a user in a supergroup or a channel. The bo
|
|||
| `can_invite_users` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can invite new users to the chat |
|
||||
| `can_restrict_members` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can restrict, ban or unban chat members |
|
||||
| `can_pin_messages` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can pin messages, supergroups only |
|
||||
| `can_promote_members` | `#!python3 Optional[bool]` | Optional. 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) |
|
||||
| `can_promote_members` | `#!python3 Optional[bool]` | Optional. Pass True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him) |
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Use this method to restrict a user in a supergroup. The bot must be an administr
|
|||
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) |
|
||||
| `user_id` | `#!python3 int` | Unique identifier of the target user |
|
||||
| `permissions` | `#!python3 ChatPermissions` | New user permissions |
|
||||
| `until_date` | `#!python3 Optional[Union[int, datetime.datetime, datetime.timedelta]]` | Optional. 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 |
|
||||
| `until_date` | `#!python3 Optional[Union[datetime.datetime, datetime.timedelta, int]]` | Optional. 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 |
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without s
|
|||
| `height` | `#!python3 Optional[int]` | Optional. Animation height |
|
||||
| `thumb` | `#!python3 Optional[Union[InputFile, str]]` | Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. |
|
||||
| `caption` | `#!python3 Optional[str]` | Optional. Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the animation caption. See formatting options for more details. |
|
||||
| `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. |
|
||||
| `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message |
|
||||
| `reply_markup` | `#!python3 Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` | Optional. 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. |
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ For sending voice messages, use the sendVoice method instead.
|
|||
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
||||
| `audio` | `#!python3 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. |
|
||||
| `caption` | `#!python3 Optional[str]` | Optional. Audio caption, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the audio caption. See formatting options for more details. |
|
||||
| `duration` | `#!python3 Optional[int]` | Optional. Duration of the audio in seconds |
|
||||
| `performer` | `#!python3 Optional[str]` | Optional. Performer |
|
||||
| `title` | `#!python3 Optional[str]` | Optional. Track name |
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ Use this method to send a dice, which will have a random value from 1 to 6. On s
|
|||
| Name | Type | Description |
|
||||
| - | - | - |
|
||||
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
||||
| `emoji` | `#!python3 Optional[str]` | Optional. Emoji on which the dice throw animation is based. Currently, must be one of '' or ''. Defauts to '' |
|
||||
| `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. |
|
||||
| `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message |
|
||||
| `reply_markup` | `#!python3 Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` | Optional. 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. |
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Use this method to send general files. On success, the sent Message is returned.
|
|||
| `document` | `#!python3 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. |
|
||||
| `thumb` | `#!python3 Optional[Union[InputFile, str]]` | Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. |
|
||||
| `caption` | `#!python3 Optional[str]` | Optional. Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the document caption. See formatting options for more details. |
|
||||
| `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. |
|
||||
| `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message |
|
||||
| `reply_markup` | `#!python3 Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` | Optional. 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. |
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Use this method to send a group of photos or videos as an album. On success, an
|
|||
| Name | Type | Description |
|
||||
| - | - | - |
|
||||
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
||||
| `media` | `#!python3 List[Union[InputMediaPhoto, InputMediaVideo]]` | A JSON-serialized array describing photos and videos to be sent, must include 2–10 items |
|
||||
| `media` | `#!python3 List[Union[InputMediaPhoto, InputMediaVideo]]` | A JSON-serialized array describing photos and videos to be sent, must include 2-10 items |
|
||||
| `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the messages silently. Users will receive a notification with no sound. |
|
||||
| `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the messages are a reply, ID of the original message |
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Use this method to send text messages. On success, the sent Message is returned.
|
|||
| - | - | - |
|
||||
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
||||
| `text` | `#!python3 str` | Text of the message to be sent, 1-4096 characters after entities parsing |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the message text. See formatting options for more details. |
|
||||
| `disable_web_page_preview` | `#!python3 Optional[bool]` | Optional. Disables link previews for links in this message |
|
||||
| `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. |
|
||||
| `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message |
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Use this method to send photos. On success, the sent Message is returned.
|
|||
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
||||
| `photo` | `#!python3 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. |
|
||||
| `caption` | `#!python3 Optional[str]` | Optional. Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the photo caption. See formatting options for more details. |
|
||||
| `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. |
|
||||
| `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message |
|
||||
| `reply_markup` | `#!python3 Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]]` | Optional. 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. |
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ Use this method to send a native poll. On success, the sent Message is returned.
|
|||
| `type` | `#!python3 Optional[str]` | Optional. Poll type, 'quiz' or 'regular', defaults to 'regular' |
|
||||
| `allows_multiple_answers` | `#!python3 Optional[bool]` | Optional. True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False |
|
||||
| `correct_option_id` | `#!python3 Optional[int]` | Optional. 0-based identifier of the correct answer option, required for polls in quiz mode |
|
||||
| `explanation` | `#!python3 Optional[str]` | Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing |
|
||||
| `explanation_parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the explanation. See formatting options for more details. |
|
||||
| `open_period` | `#!python3 Optional[int]` | Optional. Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date. |
|
||||
| `close_date` | `#!python3 Optional[Union[datetime.datetime, datetime.timedelta, int]]` | Optional. Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with open_period. |
|
||||
| `is_closed` | `#!python3 Optional[bool]` | Optional. Pass True, if the poll needs to be immediately closed. This can be useful for poll preview. |
|
||||
| `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. |
|
||||
| `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message |
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Use this method to send video files, Telegram clients support mp4 videos (other
|
|||
| `height` | `#!python3 Optional[int]` | Optional. Video height |
|
||||
| `thumb` | `#!python3 Optional[Union[InputFile, str]]` | Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. |
|
||||
| `caption` | `#!python3 Optional[str]` | Optional. Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the video caption. See formatting options for more details. |
|
||||
| `supports_streaming` | `#!python3 Optional[bool]` | Optional. Pass True, if the uploaded video is suitable for streaming |
|
||||
| `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. |
|
||||
| `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message |
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Use this method to send audio files, if you want Telegram clients to display the
|
|||
| `chat_id` | `#!python3 Union[int, str]` | Unique identifier for the target chat or username of the target channel (in the format @channelusername) |
|
||||
| `voice` | `#!python3 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. |
|
||||
| `caption` | `#!python3 Optional[str]` | Optional. Voice message caption, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python3 Optional[str]` | Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. |
|
||||
| `duration` | `#!python3 Optional[int]` | Optional. Duration of the voice message in seconds |
|
||||
| `disable_notification` | `#!python3 Optional[bool]` | Optional. Sends the message silently. Users will receive a notification with no sound. |
|
||||
| `reply_to_message_id` | `#!python3 Optional[int]` | Optional. If the message is a reply, ID of the original message |
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Use this method to upload a .PNG file with a sticker for later use in createNewS
|
|||
| Name | Type | Description |
|
||||
| - | - | - |
|
||||
| `user_id` | `#!python3 int` | User identifier of sticker file owner |
|
||||
| `png_sticker` | `#!python3 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_sticker` | `#!python3 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. |
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,13 +12,13 @@ This object contains information about one member of a chat.
|
|||
| `user` | `#!python User` | Information about the user |
|
||||
| `status` | `#!python str` | The member's status in the chat. Can be 'creator', 'administrator', 'member', 'restricted', 'left' or 'kicked' |
|
||||
| `custom_title` | `#!python Optional[str]` | Optional. Owner and administrators only. Custom title for this user |
|
||||
| `until_date` | `#!python Optional[Union[int, datetime.datetime, datetime.timedelta]]` | Optional. Restricted and kicked only. Date when restrictions will be lifted for this user; unix time |
|
||||
| `until_date` | `#!python Optional[Union[datetime.datetime, datetime.timedelta, int]]` | Optional. Restricted and kicked only. Date when restrictions will be lifted for this user; unix time |
|
||||
| `can_be_edited` | `#!python Optional[bool]` | Optional. Administrators only. True, if the bot is allowed to edit administrator privileges of that user |
|
||||
| `can_post_messages` | `#!python Optional[bool]` | Optional. Administrators only. True, if the administrator can post in the channel; channels only |
|
||||
| `can_edit_messages` | `#!python Optional[bool]` | Optional. Administrators only. True, if the administrator can edit messages of other users and can pin messages; channels only |
|
||||
| `can_delete_messages` | `#!python Optional[bool]` | Optional. Administrators only. True, if the administrator can delete messages of other users |
|
||||
| `can_restrict_members` | `#!python Optional[bool]` | Optional. Administrators only. True, if the administrator can restrict, ban or unban chat members |
|
||||
| `can_promote_members` | `#!python Optional[bool]` | Optional. 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_promote_members` | `#!python Optional[bool]` | Optional. Administrators only. True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user) |
|
||||
| `can_change_info` | `#!python Optional[bool]` | Optional. Administrators and restricted only. True, if the user is allowed to change the chat title, photo and other settings |
|
||||
| `can_invite_users` | `#!python Optional[bool]` | Optional. Administrators and restricted only. True, if the user is allowed to invite new users to the chat |
|
||||
| `can_pin_messages` | `#!python Optional[bool]` | Optional. Administrators and restricted only. True, if the user is allowed to pin messages; groups and supergroups only |
|
||||
|
|
|
|||
|
|
@ -2,14 +2,15 @@
|
|||
|
||||
## Description
|
||||
|
||||
This object represents a dice with random value from 1 to 6. (Yes, we're aware of the 'proper' singular of die. But it's awkward, and we decided to help it change. One dice at a time!)
|
||||
This object represents a dice with a random value from 1 to 6 for currently supported base emoji. (Yes, we're aware of the 'proper' singular of die. But it's awkward, and we decided to help it change. One dice at a time!)
|
||||
|
||||
|
||||
## Attributes
|
||||
|
||||
| Name | Type | Description |
|
||||
| - | - | - |
|
||||
| `value` | `#!python int` | Value of the dice, 1-6 |
|
||||
| `emoji` | `#!python str` | Emoji on which the dice throw animation is based |
|
||||
| `value` | `#!python int` | Value of the dice, 1-6 for currently supported base emoji |
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ This object represents one button of an inline keyboard. You must use exactly on
|
|||
| `login_url` | `#!python Optional[LoginUrl]` | Optional. An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. |
|
||||
| `callback_data` | `#!python Optional[str]` | Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes |
|
||||
| `switch_inline_query` | `#!python Optional[str]` | Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot‘s username and the specified inline query in the input field. Can be empty, in which case just the bot’s username will be inserted. |
|
||||
| `switch_inline_query_current_chat` | `#!python Optional[str]` | Optional. If set, pressing the button will insert the bot‘s username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot’s username will be inserted. |
|
||||
| `switch_inline_query_current_chat` | `#!python Optional[str]` | Optional. If set, pressing the button will insert the bot‘s username and the specified inline query in the current chat’s input field. Can be empty, in which case only the bot's username will be inserted. |
|
||||
| `callback_game` | `#!python Optional[CallbackGame]` | Optional. Description of the game that will be launched when the user presses the button. |
|
||||
| `pay` | `#!python Optional[bool]` | Optional. Specify True, to send a Pay button. |
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Note: This will only work in Telegram versions released after 9 April, 2016. Old
|
|||
| `audio_url` | `#!python str` | A valid URL for the audio file |
|
||||
| `title` | `#!python str` | Title |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the audio caption. See formatting options for more details. |
|
||||
| `performer` | `#!python Optional[str]` | Optional. Performer |
|
||||
| `audio_duration` | `#!python Optional[int]` | Optional. Audio duration in seconds |
|
||||
| `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message |
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ Note: This will only work in Telegram versions released after 9 April, 2016. Old
|
|||
| `id` | `#!python str` | Unique identifier for this result, 1-64 bytes |
|
||||
| `audio_file_id` | `#!python str` | A valid file identifier for the audio file |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the audio caption. See formatting options for more details. |
|
||||
| `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message |
|
||||
| `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the audio |
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ Note: This will only work in Telegram versions released after 9 April, 2016. Old
|
|||
| `document_file_id` | `#!python str` | A valid file identifier for the file |
|
||||
| `description` | `#!python Optional[str]` | Optional. Short description of the result |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption of the document to be sent, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the document caption. See formatting options for more details. |
|
||||
| `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message |
|
||||
| `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the file |
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Represents a link to an animated GIF file stored on the Telegram servers. By def
|
|||
| `gif_file_id` | `#!python str` | A valid file identifier for the GIF file |
|
||||
| `title` | `#!python Optional[str]` | Optional. Title for the result |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the caption. See formatting options for more details. |
|
||||
| `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message |
|
||||
| `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the GIF animation |
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) st
|
|||
| `mpeg4_file_id` | `#!python str` | A valid file identifier for the MP4 file |
|
||||
| `title` | `#!python Optional[str]` | Optional. Title for the result |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the caption. See formatting options for more details. |
|
||||
| `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message |
|
||||
| `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the video animation |
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ Represents a link to a photo stored on the Telegram servers. By default, this ph
|
|||
| `title` | `#!python Optional[str]` | Optional. Title for the result |
|
||||
| `description` | `#!python Optional[str]` | Optional. Short description of the result |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the photo caption. See formatting options for more details. |
|
||||
| `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message |
|
||||
| `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the photo |
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ Represents a link to a video file stored on the Telegram servers. By default, th
|
|||
| `title` | `#!python str` | Title for the result |
|
||||
| `description` | `#!python Optional[str]` | Optional. Short description of the result |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption of the video to be sent, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the video caption. See formatting options for more details. |
|
||||
| `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message |
|
||||
| `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the video |
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Note: This will only work in Telegram versions released after 9 April, 2016. Old
|
|||
| `voice_file_id` | `#!python str` | A valid file identifier for the voice message |
|
||||
| `title` | `#!python str` | Voice message title |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. |
|
||||
| `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message |
|
||||
| `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the voice message |
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ Note: This will only work in Telegram versions released after 9 April, 2016. Old
|
|||
| `document_url` | `#!python str` | A valid URL for the file |
|
||||
| `mime_type` | `#!python str` | Mime type of the content of the file, either 'application/pdf' or 'application/zip' |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption of the document to be sent, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the document caption. See formatting options for more details. |
|
||||
| `description` | `#!python Optional[str]` | Optional. Short description of the result |
|
||||
| `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message |
|
||||
| `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the file |
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Represents a link to an animated GIF file. By default, this animated GIF file wi
|
|||
| `gif_duration` | `#!python Optional[int]` | Optional. Duration of the GIF |
|
||||
| `title` | `#!python Optional[str]` | Optional. Title for the result |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the caption. See formatting options for more details. |
|
||||
| `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message |
|
||||
| `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the GIF animation |
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). B
|
|||
| `mpeg4_duration` | `#!python Optional[int]` | Optional. Video duration |
|
||||
| `title` | `#!python Optional[str]` | Optional. Title for the result |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the caption. See formatting options for more details. |
|
||||
| `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message |
|
||||
| `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the video animation |
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Represents a link to a photo. By default, this photo will be sent by the user wi
|
|||
| `title` | `#!python Optional[str]` | Optional. Title for the result |
|
||||
| `description` | `#!python Optional[str]` | Optional. Short description of the result |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the photo caption. See formatting options for more details. |
|
||||
| `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message |
|
||||
| `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the photo |
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube),
|
|||
| `thumb_url` | `#!python str` | URL of the thumbnail (jpeg only) for the video |
|
||||
| `title` | `#!python str` | Title for the result |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption of the video to be sent, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the video caption. See formatting options for more details. |
|
||||
| `video_width` | `#!python Optional[int]` | Optional. Video width |
|
||||
| `video_height` | `#!python Optional[int]` | Optional. Video height |
|
||||
| `video_duration` | `#!python Optional[int]` | Optional. Video duration in seconds |
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Note: This will only work in Telegram versions released after 9 April, 2016. Old
|
|||
| `voice_url` | `#!python str` | A valid URL for the voice recording |
|
||||
| `title` | `#!python str` | Recording title |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. |
|
||||
| `voice_duration` | `#!python Optional[int]` | Optional. Recording duration in seconds |
|
||||
| `reply_markup` | `#!python Optional[InlineKeyboardMarkup]` | Optional. Inline keyboard attached to the message |
|
||||
| `input_message_content` | `#!python Optional[InputMessageContent]` | Optional. Content of the message to be sent instead of the voice recording |
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be
|
|||
| `media` | `#!python Union[str, InputFile]` | File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. |
|
||||
| `thumb` | `#!python Optional[Union[InputFile, str]]` | Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption of the animation to be sent, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the animation caption. See formatting options for more details. |
|
||||
| `width` | `#!python Optional[int]` | Optional. Animation width |
|
||||
| `height` | `#!python Optional[int]` | Optional. Animation height |
|
||||
| `duration` | `#!python Optional[int]` | Optional. Animation duration |
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Represents an audio file to be treated as music to be sent.
|
|||
| `media` | `#!python Union[str, InputFile]` | File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. |
|
||||
| `thumb` | `#!python Optional[Union[InputFile, str]]` | Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption of the audio to be sent, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the audio caption. See formatting options for more details. |
|
||||
| `duration` | `#!python Optional[int]` | Optional. Duration of the audio in seconds |
|
||||
| `performer` | `#!python Optional[str]` | Optional. Performer of the audio |
|
||||
| `title` | `#!python Optional[str]` | Optional. Title of the audio |
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Represents a general file to be sent.
|
|||
| `media` | `#!python Union[str, InputFile]` | File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. |
|
||||
| `thumb` | `#!python Optional[Union[InputFile, str]]` | Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption of the document to be sent, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the document caption. See formatting options for more details. |
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Represents a photo to be sent.
|
|||
| `type` | `#!python str` | Type of the result, must be photo |
|
||||
| `media` | `#!python Union[str, InputFile]` | File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the photo caption. See formatting options for more details. |
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Represents a video to be sent.
|
|||
| `media` | `#!python Union[str, InputFile]` | File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass 'attach://<file_attach_name>' to upload a new one using multipart/form-data under <file_attach_name> name. |
|
||||
| `thumb` | `#!python Optional[Union[InputFile, str]]` | Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 'attach://<file_attach_name>' if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. |
|
||||
| `caption` | `#!python Optional[str]` | Optional. Caption of the video to be sent, 0-1024 characters after entities parsing |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the video caption. See formatting options for more details. |
|
||||
| `width` | `#!python Optional[int]` | Optional. Video width |
|
||||
| `height` | `#!python Optional[int]` | Optional. Video height |
|
||||
| `duration` | `#!python Optional[int]` | Optional. Video duration |
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Represents the content of a text message to be sent as the result of an inline q
|
|||
| Name | Type | Description |
|
||||
| - | - | - |
|
||||
| `message_text` | `#!python str` | Text of the message to be sent, 1-4096 characters |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. |
|
||||
| `parse_mode` | `#!python Optional[str]` | Optional. Mode for parsing entities in the message text. See formatting options for more details. |
|
||||
| `disable_web_page_preview` | `#!python Optional[bool]` | Optional. Disables link previews for links in the sent message |
|
||||
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue