mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Merge remote-tracking branch 'origin/dev-3.x' into dev-3.x
This commit is contained in:
commit
648395c1a2
2 changed files with 12 additions and 5 deletions
1
CHANGES/1520.bugfix.rst
Normal file
1
CHANGES/1520.bugfix.rst
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fixed event context resolving for the callback query that is coming from the business account
|
||||
|
|
@ -80,14 +80,20 @@ class UserContextMiddleware(BaseMiddleware):
|
|||
if event.chosen_inline_result:
|
||||
return EventContext(user=event.chosen_inline_result.from_user)
|
||||
if event.callback_query:
|
||||
if event.callback_query.message:
|
||||
callback_query_message = event.callback_query.message
|
||||
if callback_query_message:
|
||||
return EventContext(
|
||||
chat=event.callback_query.message.chat,
|
||||
chat=callback_query_message.chat,
|
||||
user=event.callback_query.from_user,
|
||||
thread_id=(
|
||||
event.callback_query.message.message_thread_id
|
||||
if not isinstance(event.callback_query.message, InaccessibleMessage)
|
||||
and event.callback_query.message.is_topic_message
|
||||
callback_query_message.message_thread_id
|
||||
if not isinstance(callback_query_message, InaccessibleMessage)
|
||||
and callback_query_message.is_topic_message
|
||||
else None
|
||||
),
|
||||
business_connection_id=(
|
||||
callback_query_message.business_connection_id
|
||||
if not isinstance(callback_query_message, InaccessibleMessage)
|
||||
else None
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue