mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
A small speedup in Dispatcher
According to telegram Update specification: https://core.telegram.org/bots/api#update "At most one of the optional parameters can be present in any given update."
This commit is contained in:
parent
aec67b18af
commit
b2d2b018a7
1 changed files with 10 additions and 10 deletions
|
|
@ -206,36 +206,36 @@ class Dispatcher(DataMixin, ContextInstanceMixin):
|
|||
types.User.set_current(update.message.from_user)
|
||||
types.Chat.set_current(update.message.chat)
|
||||
return await self.message_handlers.notify(update.message)
|
||||
if update.edited_message:
|
||||
elif update.edited_message:
|
||||
types.User.set_current(update.edited_message.from_user)
|
||||
types.Chat.set_current(update.edited_message.chat)
|
||||
return await self.edited_message_handlers.notify(update.edited_message)
|
||||
if update.channel_post:
|
||||
elif update.channel_post:
|
||||
types.Chat.set_current(update.channel_post.chat)
|
||||
return await self.channel_post_handlers.notify(update.channel_post)
|
||||
if update.edited_channel_post:
|
||||
elif update.edited_channel_post:
|
||||
types.Chat.set_current(update.edited_channel_post.chat)
|
||||
return await self.edited_channel_post_handlers.notify(update.edited_channel_post)
|
||||
if update.inline_query:
|
||||
elif update.inline_query:
|
||||
types.User.set_current(update.inline_query.from_user)
|
||||
return await self.inline_query_handlers.notify(update.inline_query)
|
||||
if update.chosen_inline_result:
|
||||
elif update.chosen_inline_result:
|
||||
types.User.set_current(update.chosen_inline_result.from_user)
|
||||
return await self.chosen_inline_result_handlers.notify(update.chosen_inline_result)
|
||||
if update.callback_query:
|
||||
elif update.callback_query:
|
||||
if update.callback_query.message:
|
||||
types.Chat.set_current(update.callback_query.message.chat)
|
||||
types.User.set_current(update.callback_query.from_user)
|
||||
return await self.callback_query_handlers.notify(update.callback_query)
|
||||
if update.shipping_query:
|
||||
elif update.shipping_query:
|
||||
types.User.set_current(update.shipping_query.from_user)
|
||||
return await self.shipping_query_handlers.notify(update.shipping_query)
|
||||
if update.pre_checkout_query:
|
||||
elif update.pre_checkout_query:
|
||||
types.User.set_current(update.pre_checkout_query.from_user)
|
||||
return await self.pre_checkout_query_handlers.notify(update.pre_checkout_query)
|
||||
if update.poll:
|
||||
elif update.poll:
|
||||
return await self.poll_handlers.notify(update.poll)
|
||||
if update.poll_answer:
|
||||
elif update.poll_answer:
|
||||
return await self.poll_answer_handlers.notify(update.poll_answer)
|
||||
except Exception as e:
|
||||
err = await self.errors_handlers.notify(update, e)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue