GeezerVison is showing docs.python-telegram-bot.org — CallbackQuery - python-telegram-bot v22.8
CallbackQuery¶
-
class telegram.CallbackQuery(id, from_user, chat_instance, message=None, data=None, inline_message_id=None, game_short_name=None, *, api_kwargs=None)[source]¶
Bases: telegram.TelegramObject
This object represents an incoming callback query from a callback button in an inline keyboard.
If the button that originated the query was attached to a message sent by the bot, the field
message will be present. If the button was attached to a message sent via the bot (in
inline mode), the field inline_message_id will be present.
Objects of this class are comparable in terms of equality. Two objects of this class are
considered equal, if their id is equal.
- Parameters:
id (str) – Unique identifier for this query.
from_user (telegram.User) – Sender.
chat_instance (str) – Global identifier, uniquely corresponding to the chat to which
the message with the callback button was sent. Useful for high scores in games.
message (telegram.MaybeInaccessibleMessage, optional) – Message sent by the bot
with the callback button that originated the query.
data (str, optional) – Data associated with the callback button. Be aware that the
message, which originated the query, can contain no callback buttons with this data.
inline_message_id (str, optional) – Identifier of the message sent via the bot in
inline mode, that originated the query.
game_short_name (str, optional) – Short name of a Game to be returned, serves as
the unique identifier for the game.
-
id[source]¶
Unique identifier for this query.
- Type:
str
-
from_user[source]¶
Sender.
- Type:
telegram.User
-
chat_instance[source]¶
Global identifier, uniquely corresponding to the chat to which
the message with the callback button was sent. Useful for high scores in games.
- Type:
str
-
message[source]¶
Optional. Message sent by the bot
with the callback button that originated the query.
- Type:
telegram.MaybeInaccessibleMessage
-
data[source]¶
Optional. Data associated with the callback button.
Be aware that the message, which originated the query, can contain no callback buttons
with this data.
- Type:
str | object
-
inline_message_id[source]¶
Optional. Identifier of the message sent via the bot in
inline mode, that originated the query.
- Type:
str
-
game_short_name[source]¶
Optional. Short name of a Game to be returned, serves as
the unique identifier for the game.
- Type:
str
-
MAX_ANSWER_TEXT_LENGTH = 200[source]¶
telegram.constants.CallbackQueryLimit.ANSWER_CALLBACK_QUERY_TEXT_LENGTH
-
async answer(text=None, show_alert=None, url=None, cache_time=None, *, read_timeout=None, write_timeout=None, connect_timeout=None, pool_timeout=None, api_kwargs=None)[source]¶
Shortcut for:
await bot.answer_callback_query(update.callback_query.id, *args, **kwargs)
For the documentation of the arguments, please see
telegram.Bot.answer_callback_query().
- Returns:
On success, True is returned.
- Return type:
bool
-
async copy_message(chat_id, caption=None, parse_mode=None, caption_entities=None, disable_notification=None, reply_markup=None, protect_content=None, message_thread_id=None, reply_parameters=None, show_caption_above_media=None, allow_paid_broadcast=None, video_start_timestamp=None, suggested_post_parameters=None, message_effect_id=None, *, allow_sending_without_reply=None, reply_to_message_id=None, read_timeout=None, write_timeout=None, connect_timeout=None, pool_timeout=None, api_kwargs=None)[source]¶
Shortcut for:
await update.callback_query.message.copy(
from_chat_id=update.message.chat_id,
message_id=update.message.message_id,
direct_messages_topic_id=update.message.direct_messages_topic.topic_id,
*args,
**kwargs
)
For the documentation of the arguments, please see telegram.Message.copy().
- Returns:
On success, returns the MessageId of the sent message.
- Return type:
telegram.MessageId
- Raises:
TypeError –
-
classmethod de_json(data, bot=None)[source]¶
See telegram.TelegramObject.de_json().
-
async delete_message(*, read_timeout=None, write_timeout=None, connect_timeout=None, pool_timeout=None, api_kwargs=None)[source]¶
Shortcut for:
await update.callback_query.message.delete(*args, **kwargs)
For the documentation of the arguments, please see telegram.Message.delete().
- Returns:
On success, True is returned.
- Return type:
bool
- Raises:
TypeError –
-
async edit_message_caption(caption=None, reply_markup=None, parse_mode=None, caption_entities=None, show_caption_above_media=None, *, read_timeout=None, write_timeout=None, connect_timeout=None, pool_timeout=None, api_kwargs=None)[source]¶
Shortcut for either:
await update.callback_query.message.edit_caption(*args, **kwargs)
or:
await bot.edit_message_caption(
inline_message_id=update.callback_query.inline_message_id, *args, **kwargs,
)
For the documentation of the arguments, please see
telegram.Bot.edit_message_caption() and telegram.Message.edit_caption().
- Returns:
On success, if edited message is sent by the bot, the
edited Message is returned, otherwise True is returned.
- Return type:
telegram.Message
- Raises:
TypeError –
-
async edit_message_checklist(checklist, reply_markup=None, *, read_timeout=None, write_timeout=None, connect_timeout=None, pool_timeout=None, api_kwargs=None)[source]¶
Shortcut for:
await update.callback_query.message.edit_checklist(*args, **kwargs)
For the documentation of the arguments, please see
telegram.Message.edit_checklist().
- Returns:
On success, the edited Message is returned.
- Return type:
telegram.Message
- Raises:
TypeError –
-
async edit_message_live_location(latitude=None, longitude=None, reply_markup=None, horizontal_accuracy=None, heading=None, proximity_alert_radius=None, live_period=None, *, location=None, read_timeout=None, write_timeout=None, connect_timeout=None, pool_timeout=None, api_kwargs=None)[source]¶
Shortcut for either:
await update.callback_query.message.edit_live_location(*args, **kwargs)
or:
await bot.edit_message_live_location(
inline_message_id=update.callback_query.inline_message_id, *args, **kwargs
)
For the documentation of the arguments, please see
telegram.Bot.edit_message_live_location() and
telegram.Message.edit_live_location().
- Returns:
On success, if edited message is sent by the bot, the
edited Message is returned, otherwise True is returned.
- Return type:
telegram.Message
- Raises:
TypeError –
-
async edit_message_media(media, reply_markup=None, *, read_timeout=None, write_timeout=None, connect_timeout=None, pool_timeout=None, api_kwargs=None)[source]¶
Shortcut for either:
await update.callback_query.message.edit_media(*args, **kwargs)
or:
await bot.edit_message_media(
inline_message_id=update.callback_query.inline_message_id, *args, **kwargs
)
For the documentation of the arguments, please see
telegram.Bot.edit_message_media() and telegram.Message.edit_media().
- Returns:
On success, if edited message is not an inline message, the
edited Message is returned, otherwise True is returned.
- Return type:
telegram.Message
- Raises:
TypeError –
-
async edit_message_reply_markup(reply_markup=None, *, read_timeout=None, write_timeout=None, connect_timeout=None, pool_timeout=None, api_kwargs=None)[source]¶
Shortcut for either:
await update.callback_query.message.edit_reply_markup(*args, **kwargs)
or:
await bot.edit_message_reply_markup(
inline_message_id=update.callback_query.inline_message_id, *args, **kwargs
)
For the documentation of the arguments, please see
telegram.Bot.edit_message_reply_markup() and
telegram.Message.edit_reply_markup().
- Returns:
On success, if edited message is sent by the bot, the
edited Message is returned, otherwise True is returned.
- Return type:
telegram.Message
- Raises:
TypeError –
-
async edit_message_text(text, parse_mode=None, reply_markup=None, entities=None, link_preview_options=None, *, disable_web_page_preview=None, read_timeout=None, write_timeout=None, connect_timeout=None, pool_timeout=None, api_kwargs=None)[source]¶
Shortcut for either:
await update.callback_query.message.edit_text(*args, **kwargs)
or:
await bot.edit_message_text(
inline_message_id=update.callback_query.inline_message_id, *args, **kwargs,
)
For the documentation of the arguments, please see
telegram.Bot.edit_message_text() and telegram.Message.edit_text().
- Returns:
On success, if edited message is sent by the bot, the
edited Message is returned, otherwise True is returned.
- Return type:
telegram.Message
- Raises:
TypeError –
-
async get_game_high_scores(user_id, *, read_timeout=None, write_timeout=None, connect_timeout=None, pool_timeout=None, api_kwargs=None)[source]¶
Shortcut for either:
await update.callback_query.message.get_game_high_score(*args, **kwargs)
or:
await bot.get_game_high_scores(
inline_message_id=update.callback_query.inline_message_id, *args, **kwargs
)
For the documentation of the arguments, please see
telegram.Bot.get_game_high_scores() and
telegram.Message.get_game_high_scores().
- Returns:
tuple[telegram.GameHighScore]
- Raises:
TypeError –
-
async pin_message(disable_notification=None, *, read_timeout=None, write_timeout=None, connect_timeout=None, pool_timeout=None, api_kwargs=None)[source]¶
Shortcut for:
await update.callback_query.message.pin(*args, **kwargs)
For the documentation of the arguments, please see telegram.Message.pin().
- Returns:
On success, True is returned.
- Return type:
bool
- Raises:
TypeError –
-
async set_game_score(user_id, score, force=None, disable_edit_message=None, *, read_timeout=None, write_timeout=None, connect_timeout=None, pool_timeout=None, api_kwargs=None)[source]¶
Shortcut for either:
await update.callback_query.message.set_game_score(*args, **kwargs)
or:
await bot.set_game_score(
inline_message_id=update.callback_query.inline_message_id, *args, **kwargs
)
For the documentation of the arguments, please see
telegram.Bot.set_game_score() and telegram.Message.set_game_score().
- Returns:
On success, if edited message is sent by the bot, the
edited Message is returned, otherwise True is returned.
- Return type:
telegram.Message
- Raises:
TypeError –
-
async stop_message_live_location(reply_markup=None, *, read_timeout=None, write_timeout=None, connect_timeout=None, pool_timeout=None, api_kwargs=None)[source]¶
Shortcut for either:
await update.callback_query.message.stop_live_location(*args, **kwargs)
or:
await bot.stop_message_live_location(
inline_message_id=update.callback_query.inline_message_id, *args, **kwargs
)
For the documentation of the arguments, please see
telegram.Bot.stop_message_live_location() and
telegram.Message.stop_live_location().
- Returns:
On success, if edited message is sent by the bot, the
edited Message is returned, otherwise True is returned.
- Return type:
telegram.Message
- Raises:
TypeError –
-
async unpin_message(*, read_timeout=None, write_timeout=None, connect_timeout=None, pool_timeout=None, api_kwargs=None)[source]¶
Shortcut for:
await update.callback_query.message.unpin(*args, **kwargs)
For the documentation of the arguments, please see telegram.Message.unpin().
- Returns:
On success, True is returned.
- Return type:
bool
- Raises:
TypeError –
|