pytdbot.types.bound_methods
- class pytdbot.types.bound_methods.CallbackQueryBoundMethods[source]
Bases:
object
- __init__()[source]
- async answer(text, show_alert=None, url=None, cache_time=None)[source]
Answer to callback query. Shortcut for
answerCallbackQuery()
- async edit_message_caption(caption, caption_entities=None, parse_mode=None, show_caption_above_media=None, reply_markup=None)[source]
Edit message caption
- Return type:
- Parameters:
caption (str)
caption_entities (List[TextEntity] | None)
parse_mode (str | None)
show_caption_above_media (bool | None)
reply_markup (ReplyMarkup | None)
- async edit_message_reply_markup(reply_markup)[source]
Edit message reply markup. Shortcut for
editMessageReplyMarkup()
- Return type:
- Parameters:
reply_markup (ReplyMarkup)
- async edit_message_text(text, parse_mode=None, entities=None, disable_web_page_preview=False, url=None, force_small_media=None, force_large_media=None, show_above_text=None, reply_markup=None)[source]
Edit callback query message text. Shortcut for
editTextMessage()
- Return type:
- Parameters:
text (str)
parse_mode (str | None)
entities (list | None)
disable_web_page_preview (bool)
url (str | None)
force_small_media (bool | None)
force_large_media (bool | None)
show_above_text (bool | None)
reply_markup (ReplyMarkup | None)
- property callback_data: CallbackData
Callback data that was set by
callback_data()
- Parameters:
action (
Any
) – Action namedata (
Any
, optional) – Callback data
- property text: str
Callback data decoded as str
- class pytdbot.types.bound_methods.MessageBoundMethods[source]
Bases:
object
- __init__()[source]
- action(action, message_thread_id=None)[source]
Sends a chat action to a specific chat. Supporting context manager (
with
statement)Example:
- Return type:
-
async with update.action("record_video") as action: ## Any blocking operation await asyncio.sleep(10) action.setAction("upload_video") # change the action to uploading a video
- Parameters:
action (Literal['typing', 'upload_photo', 'record_video', 'upload_video', 'record_voice', 'upload_voice', 'upload_document', 'choose_sticker', 'find_location', 'record_video_note', 'upload_video_note', 'cancel'])
message_thread_id (int | None)
Or
await update.action("typing") ## Any blocking operation await asyncio.sleep(2) await update.reply_text("Hello?")
- Parameters:
- action (
str
): Type of action to broadcast. Choose one, depending on what the user is about to receive:
typing
for text messages,upload_photo
for photos,record_video
orupload_video
for videos,record_voice
orupload_voice
for voice notes,upload_document
for general files,choose_sticker
for stickers,find_location` for location data, ``record_video_note
orupload_video_note
for video notes- message_thread_id (
int
, optional): If not 0, a message thread identifier in which the action was performed. Default is
None
- action (
- async ban(banned_until_date=0)[source]
Ban the message sender
- Parameters:
banned_until_date (
int
) – Point in time (Unix timestamp) when the user will be unbanned; 0 if never. If the user is banned for more than 366 days or for less than 30 seconds from the current time, the user is considered to be banned forever. Always 0 in basic groups- Return type:
- async copy(chat_id, in_game_share=None, replace_caption=None, new_caption=None, new_caption_entities=None, parse_mode=None, disable_notification=False, protect_content=False, allow_paid_broadcast=False, message_thread_id=0, quote=None, reply_to_message_id=0)[source]
Copy message to chat. Shortcut for
sendCopy()
.- Return type:
- Parameters:
chat_id (int)
in_game_share (bool | None)
replace_caption (bool | None)
new_caption (str | None)
new_caption_entities (list | None)
parse_mode (str | None)
disable_notification (bool)
protect_content (bool)
allow_paid_broadcast (bool)
message_thread_id (int)
quote (InputTextQuote | None)
reply_to_message_id (int)
- async delete(revoke=True)[source]
Delete the received message
- async download(priority=1, offset=0, limit=0, synchronous=True)[source]
Download the media file and returns
LocalFile
object. Shortcut fordownloadFile()
.
- async edit_text(text, parse_mode=None, entities=None, disable_web_page_preview=False, url=None, force_small_media=None, force_large_media=None, show_above_text=None, reply_markup=None)[source]
Edit text message. Shortcut for
editTextMessage()
.- Return type:
- Parameters:
text (str)
parse_mode (str | None)
entities (list | None)
disable_web_page_preview (bool)
url (str | None)
force_small_media (bool | None)
force_large_media (bool | None)
show_above_text (bool | None)
reply_markup (ReplyMarkup | None)
- async forward(chat_id, in_game_share=False, disable_notification=False)[source]
Forward message to chat. Shortcut for
forwardMessage()
.
- async getChatMember()[source]
Get member info in the current chat
- Return type:
Union
[Error
,ChatMember
]
- async getMessageLink(media_timestamp=0, for_album=False, in_message_thread=False)[source]
Get message link
- Parameters:
media_timestamp (
int
) – If not 0, timestamp from which the video/audio/video note/voice note/story playing must start, in seconds. The media can be in the message content or in its link previewfor_album (
bool
) – Pass true to create a link for the whole media albumin_message_thread (
bool
) – Pass true to create a link to the message as a channel post comment, in a message thread, or a forum topic
- Return type:
Union
[Error
,MessageLink
]
- async getMessageProperties()[source]
Get the message properties
- Return type:
Union
[Error
,MessageProperties
]
- async mention(parse_mode='html')[source]
Get the text_mention of the message sender
- Parameters:
parse_mode (
str
, optional) – The parse mode of the mention. Default ishtml
- Return type:
Optional
[str
]
- async pin(disable_notification=False, only_for_self=False)[source]
Pin the message
- async react(emoji='👍', is_big=False)[source]
React to the current message
- async reply_animation(animation, thumbnail=None, caption=None, caption_entities=None, parse_mode=None, added_sticker_file_ids=None, duration=0, width=0, height=0, disable_notification=False, protect_content=False, allow_paid_broadcast=False, has_spoiler=False, message_thread_id=0, quote=None, no_reply=False, reply_markup=None)[source]
Reply to the message with animation. Shortcut for
sendAnimation()
.- Return type:
- Parameters:
animation (InputFile | str)
thumbnail (InputThumbnail | None)
caption (str | None)
caption_entities (list | None)
parse_mode (str | None)
added_sticker_file_ids (list | None)
duration (int)
width (int)
height (int)
disable_notification (bool)
protect_content (bool)
allow_paid_broadcast (bool)
has_spoiler (bool)
message_thread_id (int)
quote (InputTextQuote | None)
no_reply (bool)
reply_markup (ReplyMarkupInlineKeyboard | ReplyMarkupShowKeyboard | ReplyMarkupForceReply | ReplyMarkupRemoveKeyboard | None)
- async reply_audio(audio, album_cover_thumbnail=None, caption=None, caption_entities=None, parse_mode=None, title=None, performer=None, duration=0, disable_notification=False, protect_content=False, allow_paid_broadcast=False, message_thread_id=0, quote=None, no_reply=False, reply_markup=None)[source]
Reply to the message with audio. Shortcut for
sendAudio()
.- Return type:
- Parameters:
audio (InputFile | str)
album_cover_thumbnail (InputThumbnail | None)
caption (str | None)
caption_entities (list | None)
parse_mode (str | None)
title (str | None)
performer (str | None)
duration (int)
disable_notification (bool)
protect_content (bool)
allow_paid_broadcast (bool)
message_thread_id (int)
quote (InputTextQuote | None)
no_reply (bool)
reply_markup (ReplyMarkupInlineKeyboard | ReplyMarkupShowKeyboard | ReplyMarkupForceReply | ReplyMarkupRemoveKeyboard | None)
- async reply_document(document, thumbnail=None, caption=None, caption_entities=None, parse_mode=None, disable_content_type_detection=True, disable_notification=False, protect_content=False, allow_paid_broadcast=False, message_thread_id=0, quote=None, no_reply=False, reply_markup=None)[source]
Reply to the message with a document. Shortcut for
sendDocument()
.- Return type:
- Parameters:
document (InputFile | str)
thumbnail (InputThumbnail | None)
caption (str | None)
caption_entities (list | None)
parse_mode (str | None)
disable_content_type_detection (bool)
disable_notification (bool)
protect_content (bool)
allow_paid_broadcast (bool)
message_thread_id (int)
quote (InputTextQuote | None)
no_reply (bool)
reply_markup (ReplyMarkupInlineKeyboard | ReplyMarkupShowKeyboard | ReplyMarkupForceReply | ReplyMarkupRemoveKeyboard | None)
- async reply_photo(photo, thumbnail=None, caption=None, caption_entities=None, parse_mode=None, added_sticker_file_ids=None, width=0, height=0, self_destruct_type=None, disable_notification=False, protect_content=False, allow_paid_broadcast=False, has_spoiler=False, message_thread_id=0, quote=None, no_reply=None, reply_markup=None)[source]
Reply to the message with a photo. Shortcut for
sendPhoto()
.- Return type:
- Parameters:
photo (InputFile | str)
thumbnail (InputThumbnail | None)
caption (str | None)
caption_entities (list | None)
parse_mode (str | None)
added_sticker_file_ids (list | None)
width (int)
height (int)
self_destruct_type (MessageSelfDestructType | None)
disable_notification (bool)
protect_content (bool)
allow_paid_broadcast (bool)
has_spoiler (bool)
message_thread_id (int)
quote (InputTextQuote | None)
no_reply (bool | None)
reply_markup (ReplyMarkupInlineKeyboard | ReplyMarkupShowKeyboard | ReplyMarkupForceReply | ReplyMarkupRemoveKeyboard | None)
- async reply_sticker(sticker, emoji=None, thumbnail=None, width=0, height=0, disable_notification=False, protect_content=False, allow_paid_broadcast=False, message_thread_id=0, quote=None, no_reply=None, reply_markup=None)[source]
Reply to the message with a sticker. Shortcut for
sendSticker()
.- Return type:
- Parameters:
sticker (InputFile | str)
emoji (str | None)
thumbnail (InputThumbnail | None)
width (int)
height (int)
disable_notification (bool)
protect_content (bool)
allow_paid_broadcast (bool)
message_thread_id (int)
quote (InputTextQuote | None)
no_reply (bool | None)
reply_markup (ReplyMarkupInlineKeyboard | ReplyMarkupShowKeyboard | ReplyMarkupForceReply | ReplyMarkupRemoveKeyboard | None)
- async reply_text(text, entities=None, parse_mode=None, disable_web_page_preview=False, url=None, force_small_media=None, force_large_media=None, show_above_text=None, clear_draft=False, disable_notification=False, protect_content=False, allow_paid_broadcast=False, message_thread_id=0, quote=None, no_reply=False, reply_markup=None)[source]
Reply to the message with text. Shortcut for
sendTextMessage()
.- Return type:
- Parameters:
text (str)
entities (List[TextEntity] | None)
parse_mode (str | None)
disable_web_page_preview (bool)
url (str | None)
force_small_media (bool | None)
force_large_media (bool | None)
show_above_text (bool | None)
clear_draft (bool)
disable_notification (bool)
protect_content (bool)
allow_paid_broadcast (bool)
message_thread_id (int)
quote (InputTextQuote | None)
no_reply (bool)
reply_markup (ReplyMarkupInlineKeyboard | ReplyMarkupShowKeyboard | ReplyMarkupForceReply | ReplyMarkupRemoveKeyboard | None)
- async reply_video(video, thumbnail=None, caption=None, caption_entities=None, parse_mode=None, added_sticker_file_ids=None, supports_streaming=None, duration=0, width=0, height=0, self_destruct_type=None, disable_notification=False, protect_content=False, allow_paid_broadcast=False, has_spoiler=False, message_thread_id=0, quote=None, no_reply=None, reply_markup=None)[source]
Reply to the message with a video. Shortcut for
sendVideo()
.- Return type:
- Parameters:
video (InputFile | str)
thumbnail (InputThumbnail | None)
caption (str | None)
caption_entities (list | None)
parse_mode (str | None)
added_sticker_file_ids (list | None)
supports_streaming (bool | None)
duration (int)
width (int)
height (int)
self_destruct_type (MessageSelfDestructType | None)
disable_notification (bool)
protect_content (bool)
allow_paid_broadcast (bool)
has_spoiler (bool)
message_thread_id (int)
quote (InputTextQuote | None)
no_reply (bool | None)
reply_markup (ReplyMarkupInlineKeyboard | ReplyMarkupShowKeyboard | ReplyMarkupForceReply | ReplyMarkupRemoveKeyboard | None)
- async reply_video_note(video_note, thumbnail=None, duration=0, length=0, disable_notification=False, protect_content=False, allow_paid_broadcast=False, message_thread_id=0, quote=None, no_reply=None, reply_markup=None)[source]
Reply to the message with a video note. Shortcut for
sendVideoNote()
.- Return type:
- Parameters:
video_note (InputFile | str)
thumbnail (InputThumbnail | None)
duration (int)
length (int)
disable_notification (bool)
protect_content (bool)
allow_paid_broadcast (bool)
message_thread_id (int)
quote (InputTextQuote | None)
no_reply (bool | None)
reply_markup (ReplyMarkupInlineKeyboard | ReplyMarkupShowKeyboard | ReplyMarkupForceReply | ReplyMarkupRemoveKeyboard | None)
- async reply_voice(voice, caption=None, caption_entities=None, parse_mode=None, duration=0, waveform=None, disable_notification=False, protect_content=False, allow_paid_broadcast=False, message_thread_id=0, quote=None, no_reply=None, reply_markup=None)[source]
Reply to the message with a voice note. Shortcut for
sendVoice()
.- Return type:
- Parameters:
voice (InputFile | str)
caption (str | None)
caption_entities (list | None)
parse_mode (str | None)
duration (int)
waveform (bytes | None)
disable_notification (bool)
protect_content (bool)
allow_paid_broadcast (bool)
message_thread_id (int)
quote (InputTextQuote | None)
no_reply (bool | None)
reply_markup (ReplyMarkupInlineKeyboard | ReplyMarkupShowKeyboard | ReplyMarkupForceReply | ReplyMarkupRemoveKeyboard | None)
- async setChatMemberStatus(status)[source]
Set chat member status
- Return type:
- Parameters:
status (ChatMemberStatus)
- property caption: str | None
Caption of the received media
- property caption_entities: List[TextEntity] | None
Caption entities of the received media
- property entities: List[TextEntity] | None
Entities of the message
- property from_id: int | None
Message Sender ID
- property remote_file_id: str | None
Remote file id
- property remote_unique_file_id: str | None
Remote unique file id
- property reply_to_message_id: int
Replied message ID
- property text: str
Text of the message
- class pytdbot.types.bound_methods.MessageSenderBoundMethods[source]
Bases:
object
- __init__()[source]
- property from_id: int | None
Returns the message sender’s ID.
None
if not found
- property is_chat: bool
Returns
True
if the message sender is a chat
- property is_user: bool
Returns
True
if the message sender is a user