Skip to content

Commit

Permalink
Merge pull request #426 from Tishka17/fix/callback_business_connectio…
Browse files Browse the repository at this point in the history
…n_id

Handle no business connection id in callback
  • Loading branch information
Tishka17 authored Sep 5, 2024
2 parents 3591c71 + 502d6cf commit 5c7af1c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/aiogram_dialog/context/intent_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ def get_thread_id(message: Message) -> Optional[str]:


def event_context_from_callback(event: CallbackQuery) -> EventContext:
# native inaccessible message has no `business_connection_id`
# we can do nothing here
business_connection_id = getattr(
event.message,
"business_connection_id",
None,
)
return EventContext(
bot=event.bot,
user=event.from_user,
Expand All @@ -56,7 +63,7 @@ def event_context_from_callback(event: CallbackQuery) -> EventContext:
if isinstance(event.message, Message)
else None
),
business_connection_id=event.message.business_connection_id,
business_connection_id=business_connection_id,
)


Expand Down

0 comments on commit 5c7af1c

Please sign in to comment.