telegram.Update

class telegram.Update(update_id, message=None, edited_message=None, channel_post=None, edited_channel_post=None, inline_query=None, chosen_inline_result=None, callback_query=None, shipping_query=None, pre_checkout_query=None, **kwargs)

Bases: telegram.base.TelegramObject

This object represents an incoming update.

Note

At most one of the optional parameters can be present in any given update.

update_id

int – The update’s unique identifier.

message

telegram.Message – Optional. New incoming message.

edited_message

telegram.Message – Optional. New version of a message.

channel_post

telegram.Message – Optional. New incoming channel post.

edited_channel_post

telegram.Message – Optional. New version of a channel post.

inline_query

telegram.InlineQuery – Optional. New incoming inline query.

chosen_inline_result

telegram.ChosenInlineResult – Optional. The result of an inline query that was chosen by a user.

callback_query

telegram.CallbackQuery – Optional. New incoming callback query.

shipping_query

telegram.ShippingQuery – Optional. New incoming shipping query.

pre_checkout_query

telegram.PreCheckoutQuery – Optional. New incoming pre-checkout query.

Parameters:
  • update_id (int) – The update’s unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you’re using Webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order.
  • message (telegram.Message, optional) – New incoming message of any kind - text, photo, sticker, etc.
  • edited_message (telegram.Message, optional) – New version of a message that is known to the bot and was edited.
  • channel_post (telegram.Message, optional) – New incoming channel post of any kind - text, photo, sticker, etc.
  • edited_channel_post (telegram.Message, optional) – New version of a channel post that is known to the bot and was edited.
  • inline_query (telegram.InlineQuery, optional) – New incoming inline query.
  • chosen_inline_result (telegram.ChosenInlineResult, optional) – The result of an inline query that was chosen by a user and sent to their chat partner.
  • callback_query (telegram.CallbackQuery, optional) – New incoming callback query.
  • shipping_query (telegram.ShippingQuery, optional) – New incoming shipping query. Only for invoices with flexible price.
  • pre_checkout_query (telegram.PreCheckoutQuery, optional) – New incoming pre-checkout query. Contains full information about checkout
  • **kwargs (dict) – Arbitrary keyword arguments.
classmethod de_json(data, bot)
effective_chat

telegram.Chat – The chat that this update was sent in, no matter what kind of update this is. Will be None for inline_query, chosen_inline_result, shipping_query and pre_checkout_query.

effective_message

telegram.Message – The message included in this update, no matter what kind of update this is. Will be None for inline_query, chosen_inline_result, callback_query from inline messages, shipping_query and pre_checkout_query.

effective_user

telegram.User – The user that sent this update, no matter what kind of update this is. Will be None for channel_post.