2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 13:27:47 +00:00

Clean Update type

This commit is contained in:
Dan 2018-04-23 18:56:06 +02:00
parent 50252caec3
commit 730d5e74f0

View File

@ -20,15 +20,13 @@ from pyrogram.api.core import Object
class Update(Object): class Update(Object):
"""This object represents an incoming update.At most one of the optional parameters can be present in any given update. """This object represents an incoming update.
At most one of the optional parameters can be present in any given update.
Attributes: Attributes:
ID: ``0xb0700000`` ID: ``0xb0700000``
Args: Args:
update_id (``int`` ``32-bit``):
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. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially.
message (:obj:`Message <pyrogram.types.Message>`, optional): message (:obj:`Message <pyrogram.types.Message>`, optional):
New incoming message of any kind text, photo, sticker, etc. New incoming message of any kind text, photo, sticker, etc.
@ -45,7 +43,9 @@ class Update(Object):
New incoming inline query. New incoming inline query.
chosen_inline_result (:obj:`ChosenInlineResult <pyrogram.types.ChosenInlineResult>`, optional): chosen_inline_result (:obj:`ChosenInlineResult <pyrogram.types.ChosenInlineResult>`, optional):
The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. The result of an inline query that was chosen by a user and sent to their chat partner.
Please see our documentation on the feedback collecting for details on how to enable these updates
for your bot.
callback_query (:obj:`CallbackQuery <pyrogram.types.CallbackQuery>`, optional): callback_query (:obj:`CallbackQuery <pyrogram.types.CallbackQuery>`, optional):
New incoming callback query. New incoming callback query.
@ -59,14 +59,24 @@ class Update(Object):
""" """
ID = 0xb0700000 ID = 0xb0700000
def __init__(self, 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): def __init__(
self.update_id = update_id # int self,
self.message = message # flags.0?Message message=None,
self.edited_message = edited_message # flags.1?Message edited_message=None,
self.channel_post = channel_post # flags.2?Message channel_post=None,
self.edited_channel_post = edited_channel_post # flags.3?Message edited_channel_post=None,
self.inline_query = inline_query # flags.4?InlineQuery inline_query=None,
self.chosen_inline_result = chosen_inline_result # flags.5?ChosenInlineResult chosen_inline_result=None,
self.callback_query = callback_query # flags.6?CallbackQuery callback_query=None,
self.shipping_query = shipping_query # flags.7?ShippingQuery shipping_query=None,
self.pre_checkout_query = pre_checkout_query # flags.8?PreCheckoutQuery pre_checkout_query=None
):
self.message = message
self.edited_message = edited_message
self.channel_post = channel_post
self.edited_channel_post = edited_channel_post
self.inline_query = inline_query
self.chosen_inline_result = chosen_inline_result
self.callback_query = callback_query
self.shipping_query = shipping_query
self.pre_checkout_query = pre_checkout_query