mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
* #1520 Fixed event context resolving for the callback query that is coming from the business account * Simplify some conditions * Added changelog * Fixed AttributeError
This commit is contained in:
parent
46e033e6da
commit
7f47609585
10 changed files with 24 additions and 17 deletions
|
|
@ -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
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||
from typing import TYPE_CHECKING, Any, Literal, Union
|
||||
|
||||
from ..enums import InputPaidMediaType
|
||||
from .input_paid_media import InputPaidMedia
|
||||
from .input_file import InputFile
|
||||
from .input_paid_media import InputPaidMedia
|
||||
|
||||
|
||||
class InputPaidMediaPhoto(InputPaidMedia):
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ from aiogram.utils.text_decorations import (
|
|||
html_decoration,
|
||||
markdown_decoration,
|
||||
)
|
||||
from . import InputPaidMediaPhoto, InputPaidMediaVideo
|
||||
|
||||
from ..client.default import Default
|
||||
from ..enums import ContentType
|
||||
from . import InputPaidMediaPhoto, InputPaidMediaVideo
|
||||
from .custom import DateTime
|
||||
from .maybe_inaccessible_message import MaybeInaccessibleMessage
|
||||
|
||||
|
|
@ -38,6 +38,7 @@ if TYPE_CHECKING:
|
|||
SendLocation,
|
||||
SendMediaGroup,
|
||||
SendMessage,
|
||||
SendPaidMedia,
|
||||
SendPhoto,
|
||||
SendPoll,
|
||||
SendSticker,
|
||||
|
|
@ -48,7 +49,6 @@ if TYPE_CHECKING:
|
|||
SetMessageReaction,
|
||||
StopMessageLiveLocation,
|
||||
UnpinChatMessage,
|
||||
SendPaidMedia,
|
||||
)
|
||||
from .animation import Animation
|
||||
from .audio import Audio
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import TYPE_CHECKING, Any, List, Literal
|
||||
|
||||
from .paid_media import PaidMedia
|
||||
from ..enums import PaidMediaType
|
||||
from .paid_media import PaidMedia
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .photo_size import PhotoSize
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import TYPE_CHECKING, Any, Literal, Optional
|
||||
|
||||
from .paid_media import PaidMedia
|
||||
from ..enums import PaidMediaType
|
||||
from .paid_media import PaidMedia
|
||||
|
||||
|
||||
class PaidMediaPreview(PaidMedia):
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import TYPE_CHECKING, Any, Literal
|
||||
|
||||
from .paid_media import PaidMedia
|
||||
from ..enums import PaidMediaType
|
||||
from .paid_media import PaidMedia
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .video import Video
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue