L i׌6dZddlmZmZmZmZddlmZddlm Z m Z ddl m Z ddl mZmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZmZdd lmZddlm Z ddl!m"Z"ddl#m$Z$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-er ddlm.Z.m/Z/m0Z0Gdde'Z1y)zAThis module contains an object that represents a Telegram Update.) TYPE_CHECKINGFinalOptionalUnion) constants)BusinessConnectionBusinessMessagesDeleted) CallbackQuery)ChatBoostRemovedChatBoostUpdated)ChatJoinRequest)ChatMemberUpdated)ChosenInlineResult) InlineQuery)Message)MessageReactionCountUpdatedMessageReactionUpdated)PaidMediaPurchased)PreCheckoutQuery) ShippingQuery)Poll PollAnswer)TelegramObject)de_json_optional)JSONDict)warn)BotChatUserc5eZdZUdZdZej jZee e d< ej jZ ee e d< ej jZ ee e d< ej jZ ee e d< ej jZee e d< ej jZee e d< ej j Zee e d < ej j"Zee e d < ej j$Zee e d < ej j&Zee e d < ej j(Zee e d < ej j*Zee e d< ej j,Zee e d< ej j.Zee e d< ej j0Zee e d< ej j2Zee e d< ej j4Zee e d< ej j6Zee e d< ej j8Zee e d< ej j:Zee e d< ej j<Zee e d< ej j>Zee e d< ej j@Z ee e d< e!ej Z"ee!e e d< dCddde#de$e%de$e%d e$e%d!e$e%d"e$e&d#e$e'd$e$e(d%e$e)d&e$e*d'e$e+d(e$e,d)e$e-d*e$e-d+e$e.d,e$e/d-e$e0d.e$e1d/e$e2d0e$e3d1e$e%d2e$e%d3e$e4d4e$e5d5e$e6f2fd6Z7e8d7e$d8fd9Z9e8d7e$e:d:fd;Z;e8d7e$d<fd=ZZ=e>dDd?e6d@e$dAd7dffdB Z?xZ@S)EUpdateax4This object represents an incoming update. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`update_id` is equal. Note: At most one of the optional parameters can be present in any given update. .. seealso:: :wiki:`Your First Bot ` Args: update_id (:obj:`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. 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 (:class:`telegram.Message`, optional): New incoming message of any kind - text, photo, sticker, etc. edited_message (:class:`telegram.Message`, optional): New version of a message that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot. channel_post (:class:`telegram.Message`, optional): New incoming channel post of any kind - text, photo, sticker, etc. edited_channel_post (:class:`telegram.Message`, optional): New version of a channel post that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot. inline_query (:class:`telegram.InlineQuery`, optional): New incoming inline query. chosen_inline_result (:class:`telegram.ChosenInlineResult`, optional): The result of an inline query that was chosen by a user and sent to their chat partner. callback_query (:class:`telegram.CallbackQuery`, optional): New incoming callback query. shipping_query (:class:`telegram.ShippingQuery`, optional): New incoming shipping query. Only for invoices with flexible price. pre_checkout_query (:class:`telegram.PreCheckoutQuery`, optional): New incoming pre-checkout query. Contains full information about checkout. poll (:class:`telegram.Poll`, optional): New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot. poll_answer (:class:`telegram.PollAnswer`, optional): A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. my_chat_member (:class:`telegram.ChatMemberUpdated`, optional): The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user. .. versionadded:: 13.4 chat_member (:class:`telegram.ChatMemberUpdated`, optional): A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify :attr:`CHAT_MEMBER` in the list of :paramref:`telegram.ext.Application.run_polling.allowed_updates` to receive these updates (see :meth:`telegram.Bot.get_updates`, :meth:`telegram.Bot.set_webhook`, :meth:`telegram.ext.Application.run_polling` and :meth:`telegram.ext.Application.run_webhook`). .. versionadded:: 13.4 chat_join_request (:class:`telegram.ChatJoinRequest`, optional): A request to join the chat has been sent. The bot must have the :attr:`telegram.ChatPermissions.can_invite_users` administrator right in the chat to receive these updates. .. versionadded:: 13.8 chat_boost (:class:`telegram.ChatBoostUpdated`, optional): A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates. .. versionadded:: 20.8 removed_chat_boost (:class:`telegram.ChatBoostRemoved`, optional): A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates. .. versionadded:: 20.8 message_reaction (:class:`telegram.MessageReactionUpdated`, optional): A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify :attr:`MESSAGE_REACTION` in the list of :paramref:`telegram.ext.Application.run_polling.allowed_updates` to receive these updates (see :meth:`telegram.Bot.get_updates`, :meth:`telegram.Bot.set_webhook`, :meth:`telegram.ext.Application.run_polling` and :meth:`telegram.ext.Application.run_webhook`). The update isn't received for reactions set by bots. .. versionadded:: 20.8 message_reaction_count (:class:`telegram.MessageReactionCountUpdated`, optional): Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify :attr:`MESSAGE_REACTION_COUNT` in the list of :paramref:`telegram.ext.Application.run_polling.allowed_updates` to receive these updates (see :meth:`telegram.Bot.get_updates`, :meth:`telegram.Bot.set_webhook`, :meth:`telegram.ext.Application.run_polling` and :meth:`telegram.ext.Application.run_webhook`). The updates are grouped and can be sent with delay up to a few minutes. .. versionadded:: 20.8 business_connection (:class:`telegram.BusinessConnection`, optional): The bot was connected to or disconnected from a business account, or a user edited an existing connection with the bot. .. versionadded:: 21.1 business_message (:class:`telegram.Message`, optional): New message from a connected business account. .. versionadded:: 21.1 edited_business_message (:class:`telegram.Message`, optional): New version of a message from a connected business account. .. versionadded:: 21.1 deleted_business_messages (:class:`telegram.BusinessMessagesDeleted`, optional): Messages were deleted from a connected business account. .. versionadded:: 21.1 purchased_paid_media (:class:`telegram.PaidMediaPurchased`, optional): A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat. .. versionadded:: 21.6 Attributes: update_id (:obj:`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. 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 (:class:`telegram.Message`): Optional. New incoming message of any kind - text, photo, sticker, etc. edited_message (:class:`telegram.Message`): Optional. New version of a message that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot. channel_post (:class:`telegram.Message`): Optional. New incoming channel post of any kind - text, photo, sticker, etc. edited_channel_post (:class:`telegram.Message`): Optional. New version of a channel post that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot. inline_query (:class:`telegram.InlineQuery`): Optional. New incoming inline query. chosen_inline_result (:class:`telegram.ChosenInlineResult`): Optional. The result of an inline query that was chosen by a user and sent to their chat partner. callback_query (:class:`telegram.CallbackQuery`): Optional. New incoming callback query. Examples: :any:`Arbitrary Callback Data Bot ` shipping_query (:class:`telegram.ShippingQuery`): Optional. New incoming shipping query. Only for invoices with flexible price. pre_checkout_query (:class:`telegram.PreCheckoutQuery`): Optional. New incoming pre-checkout query. Contains full information about checkout. poll (:class:`telegram.Poll`): Optional. New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot. poll_answer (:class:`telegram.PollAnswer`): Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. my_chat_member (:class:`telegram.ChatMemberUpdated`): Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user. .. versionadded:: 13.4 chat_member (:class:`telegram.ChatMemberUpdated`): Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify :attr:`CHAT_MEMBER` in the list of :paramref:`telegram.ext.Application.run_polling.allowed_updates` to receive these updates (see :meth:`telegram.Bot.get_updates`, :meth:`telegram.Bot.set_webhook`, :meth:`telegram.ext.Application.run_polling` and :meth:`telegram.ext.Application.run_webhook`). .. versionadded:: 13.4 chat_join_request (:class:`telegram.ChatJoinRequest`): Optional. A request to join the chat has been sent. The bot must have the :attr:`telegram.ChatPermissions.can_invite_users` administrator right in the chat to receive these updates. .. versionadded:: 13.8 chat_boost (:class:`telegram.ChatBoostUpdated`): Optional. A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates. .. versionadded:: 20.8 removed_chat_boost (:class:`telegram.ChatBoostRemoved`): Optional. A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates. .. versionadded:: 20.8 message_reaction (:class:`telegram.MessageReactionUpdated`): Optional. A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify :attr:`MESSAGE_REACTION` in the list of :paramref:`telegram.ext.Application.run_polling.allowed_updates` to receive these updates (see :meth:`telegram.Bot.get_updates`, :meth:`telegram.Bot.set_webhook`, :meth:`telegram.ext.Application.run_polling` and :meth:`telegram.ext.Application.run_webhook`). The update isn't received for reactions set by bots. .. versionadded:: 20.8 message_reaction_count (:class:`telegram.MessageReactionCountUpdated`): Optional. Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify :attr:`MESSAGE_REACTION_COUNT` in the list of :paramref:`telegram.ext.Application.run_polling.allowed_updates` to receive these updates (see :meth:`telegram.Bot.get_updates`, :meth:`telegram.Bot.set_webhook`, :meth:`telegram.ext.Application.run_polling` and :meth:`telegram.ext.Application.run_webhook`). The updates are grouped and can be sent with delay up to a few minutes. .. versionadded:: 20.8 business_connection (:class:`telegram.BusinessConnection`): Optional. The bot was connected to or disconnected from a business account, or a user edited an existing connection with the bot. .. versionadded:: 21.1 business_message (:class:`telegram.Message`): Optional. New message from a connected business account. .. versionadded:: 21.1 edited_business_message (:class:`telegram.Message`): Optional. New version of a message from a connected business account. .. versionadded:: 21.1 deleted_business_messages (:class:`telegram.BusinessMessagesDeleted`): Optional. Messages were deleted from a connected business account. .. versionadded:: 21.1 purchased_paid_media (:class:`telegram.PaidMediaPurchased`): Optional. A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat. .. versionadded:: 21.6 )_effective_chat_effective_message_effective_sender_effective_userbusiness_connectionbusiness_messagecallback_query channel_post chat_boostchat_join_request chat_memberchosen_inline_resultdeleted_business_messagesedited_business_messageedited_channel_postedited_message inline_querymessagemessage_reactionmessage_reaction_countmy_chat_memberpoll poll_answerpre_checkout_querypurchased_paid_mediaremoved_chat_boostshipping_query update_idMESSAGEEDITED_MESSAGE CHANNEL_POSTEDITED_CHANNEL_POST INLINE_QUERYCHOSEN_INLINE_RESULTCALLBACK_QUERYSHIPPING_QUERYPRE_CHECKOUT_QUERYPOLL POLL_ANSWERMY_CHAT_MEMBER CHAT_MEMBERCHAT_JOIN_REQUEST CHAT_BOOSTREMOVED_CHAT_BOOSTMESSAGE_REACTIONMESSAGE_REACTION_COUNTBUSINESS_CONNECTIONBUSINESS_MESSAGEEDITED_BUSINESS_MESSAGEDELETED_BUSINESS_MESSAGESPURCHASED_PAID_MEDIA ALL_TYPESN api_kwargsr=r3r1r)r0r2r-r(r<r9r7r8r6r,r+r*r;r4r5r&r'r/r.r:rWct||||_||_||_||_||_||_| |_| |_ ||_ ||_ | |_ | |_ | |_||_||_||_||_||_||_||_||_||_||_||_d|_d|_d|_d|_|jf|_|j?y)NrV) super__init__r=r3r1r2r-r(r<r9r)r0r7r8r6r,r+r*r;r4r5r&r'r/r.r:r%r$r"r# _id_attrs_freeze)selfr=r3r1r)r0r2r-r(r<r9r7r8r6r,r+r*r;r4r5r&r'r/r.r:rW __class__s V/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/telegram/_update.pyrZzUpdate.__init__s: J/'*1 1?3?BV!7E7E>P/;6I $( 1<;I8CPBRMc#AT 3C:Q$ % &CW!/3>B/359..* returnrc|jr |jSd}|jr|jj}n|jr|jj}n|jr|jj}n|j r|j j}n|j r|j j}n|jr|jj}n_|jr|jj}n;|jr|jj}n|jr|jj}n|jr|jj}n|jr|jj}n|jr|jj}n|jr|jj}nh|j r|j j}nE|j"r|j"j}n"|j$r|j$j}||_|S)a :class:`telegram.User`: The user that sent this update, no matter what kind of update this is. If no user is associated with this update, this gives :obj:`None`. This is the case if any of * :attr:`channel_post` * :attr:`edited_channel_post` * :attr:`poll` * :attr:`chat_boost` * :attr:`removed_chat_boost` * :attr:`message_reaction_count` * :attr:`deleted_business_messages` is present. .. versionchanged:: 21.1 This property now also considers :attr:`business_connection`, :attr:`business_message` and :attr:`edited_business_message`. .. versionchanged:: 21.6 This property now also considers :attr:`purchased_paid_media`. Example: * If :attr:`message` is present, this will give :attr:`telegram.Message.from_user`. * If :attr:`poll_answer` is present, this will give :attr:`telegram.PollAnswer.user`. N)r%r3 from_userr1r2r-r(r<r9r8userr6r,r+r4r'r/r&r:)r]rds r_effective_userzUpdate.effective_users<   '' ' <<<<))D  &&00D   $$..D  & &,,66D  &&00D  &&00D  $ $**44D   ##((D  &&00D   ##--D  # #))33D  " "((--D  " "((22D  ) )//99D  % %++00D  & &,,66D# r`)rrc|jr |jSd}|jxsD|jxs6|jxs(|jxs|j xs |j x}r |j}nE|jr|jj}n"|jr|jj}| |j}||_|S)a :class:`telegram.User` or :class:`telegram.Chat`: The user or chat that sent this update, no matter what kind of update this is. Note: * Depending on the type of update and the user's 'Remain anonymous' setting, this could either be :class:`telegram.User`, :class:`telegram.Chat` or :obj:`None`. If no user whatsoever is associated with this update, this gives :obj:`None`. This is the case if any of * :attr:`poll` * :attr:`chat_boost` * :attr:`removed_chat_boost` * :attr:`message_reaction_count` * :attr:`deleted_business_messages` is present. Example: * If :attr:`message` is present, this will give either :attr:`telegram.Message.from_user` or :attr:`telegram.Message.sender_chat`. * If :attr:`poll_answer` is present, this will give either :attr:`telegram.PollAnswer.user` or :attr:`telegram.PollAnswer.voter_chat`. * If :attr:`channel_post` is present, this will give :attr:`telegram.Message.sender_chat`. .. versionadded:: 21.1 N) r$r3r1r)r0r'r/ sender_chatr8 voter_chatr4 actor_chatre)r]senderr3s r_effective_senderzUpdate.effective_sender5s>  ! !)) ).2 LL ,"" ,   ,'' ,$$  , ++  7 ((F   %%00F  " "**55F >((F!' r`rc|jr |jSd}|jr|jj}n|jr|jj}n|jr8|jjr"|jjj}n|j r|j j}n|j r|j j}n_|jr|jj}n;|jr|jj}n|jr|jj}n|jr|jj}n|jr|jj}n|jr|jj}n|jr|jj}nh|jr|jj}nE|jr|jj}n"|j r|j j}||_|S)a1 :class:`telegram.Chat`: The chat that this update was sent in, no matter what kind of update this is. If no chat is associated with this update, this gives :obj:`None`. This is the case, if :attr:`inline_query`, :attr:`chosen_inline_result`, :attr:`callback_query` from inline messages, :attr:`shipping_query`, :attr:`pre_checkout_query`, :attr:`poll`, :attr:`poll_answer`, :attr:`business_connection`, or :attr:`purchased_paid_media` is present. .. versionchanged:: 21.1 This property now also considers :attr:`business_message`, :attr:`edited_business_message`, and :attr:`deleted_business_messages`. Example: If :attr:`message` is present, this will give :attr:`telegram.Message.chat`. N)r"r3chatr1r(r)r0r6r,r+r*r;r4r5r'r/r.)r]rms r_effective_chatzUpdate.effective_chatos(   '' ' <<<<$$D  &&++D  T%8%8%@%@&&..33D   $$))D  % %++00D  &&++D   ##((D  # #))..D __??''D  $ $**//D  " "((--D  ( (..33D  " "((--D  ) )//44D  + +1166D# r`c,|jr |jSd}|jr |j}n|jr |j}n|jrQt |jjx}t s||}nt d|jjddnc|jr |j}nJ|jr |j}n1|jr |j}n|jr |j}||_|S)a :class:`telegram.Message`: The message included in this update, no matter what kind of update this is. More precisely, this will be the message contained in :attr:`message`, :attr:`edited_message`, :attr:`channel_post`, :attr:`edited_channel_post` or :attr:`callback_query` (i.e. :attr:`telegram.CallbackQuery.message`) or :obj:`None`, if none of those are present. .. versionchanged:: 21.1 This property now also considers :attr:`business_message`, and :attr:`edited_business_message`. Tip: This property will only ever return objects of type :class:`telegram.Message` or :obj:`None`, never :class:`telegram.MaybeInaccessibleMessage` or :class:`telegram.InaccessibleMessage`. Currently, this is only relevant for :attr:`callback_query`, as :attr:`telegram.CallbackQuery.message` is the only attribute considered by this property that can be an object of these types. Nz4`update.callback_query` is not `None`, but of type `zl`. This is not considered by `Update.effective_message`. Please manually access this attribute if necessary.) stacklevel) r#r3r1r( isinstancerrr^__name__r)r0r'r/)r]r3 cbq_messages r_effective_messagezUpdate.effective_messages*  " "** *%) <<llG  ))G  $*=*=*E*EE;wO&%'11::;<(( !  ''G  % %..G  " "++G  ) )22G")r`databotrc|j|}t|jdt||d<t|jdt||d<t|jdt||d<t|jdt ||d<t|jdt ||d<t|jdt||d<t|jdt||d<t|jdt||d<t|jd t||d <t|jd t||d <t|jd t||d <t|jd t||d <t|jd t||d <t|jdt||d<t|jdt||d<t|jdt||d<t|jdt||d<t|jdt ||d<t|jdt"||d<t|jdt||d<t|jdt||d<t|jdt$||d<t|jdt&||d<t(|U||S)z,See :meth:`telegram.TelegramObject.de_json`.r3r1r2r-r(r<r9r)r0r7r8r6r,r+r*r;r4r5r&r'r/r.r:)rvrw) _parse_datargetrrrr rrrrrr r r rrrr rrYde_json)clsrvrwr^s r_r{zUpdate.de_jsonst$*488I+>MY!1$((;K2LgWZ![ /0H+WZ[^'7 HH+ ,.@#(  #$"2$((;K2Lm]`!a !1$((;K2Lm]`!a %5 HH) *,rstr__annotations__r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrSrTlistrUintrrrrr rrrrrr r r rrrr rrrZpropertyrerrkrnru classmethodr{ __classcell__)r^s@r_r!r!.sgRI>$..66GU3Z6"+!5!5!D!DNE#JD )33@@L%*@'0&:&:&N&NsN )33@@L%*@(1';';'P'P%*P"+!5!5!D!DNE#JD"+!5!5!D!DNE#JD&/%9%9%L%Lc L!++00D%*0(22>>Ks>"+!5!5!D!DNE#JD(22>>Ks>%.$8$8$J$JuSzJ'11<*>*V*VU3ZV-6,@,@,Z,ZuSzZ(1';';'P'P%*P #'y';';"rs^&H88J1B59;4%`2?9+3<*)(( 3^ 3r`