mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 04:35:24 +00:00
Fix edge-case when pinned action is MessageActionHistoryClear
(#49)
* fix: edge-case when pinned action is `MessageActionHistoryClear` * fix: parsing of `ChannelAdminLogEventActionUpdatePinned` action
This commit is contained in:
parent
2b53d394d2
commit
fc89b93b5a
@ -123,6 +123,10 @@ class ChatEventAction(AutoName):
|
||||
MESSAGE_UNPINNED = auto()
|
||||
"a message has been unpinned (see ``unpinned_message``)"
|
||||
|
||||
MESSAGE_PIN_CHANGED = auto()
|
||||
"a message has been pinned or unpinned but actual message is not received"
|
||||
"should never be used in end-user code, only for correct parsing"
|
||||
|
||||
CREATED_FORUM_TOPIC = auto()
|
||||
"a new forum topic has been created (see `created_forum_topic`)"
|
||||
|
||||
|
@ -433,12 +433,14 @@ class ChatEvent(Object):
|
||||
elif isinstance(action, raw.types.ChannelAdminLogEventActionUpdatePinned):
|
||||
message = action.message
|
||||
|
||||
if message.pinned:
|
||||
if isinstance(message, raw.types.Message) and message.pinned:
|
||||
pinned_message = await types.Message._parse(client, message, users, chats)
|
||||
action = enums.ChatEventAction.MESSAGE_PINNED
|
||||
else:
|
||||
elif isinstance(message, raw.types.Message) and not message.pinned:
|
||||
unpinned_message = await types.Message._parse(client, message, users, chats)
|
||||
action = enums.ChatEventAction.MESSAGE_UNPINNED
|
||||
else:
|
||||
action = enums.ChatEventAction.MESSAGE_PIN_CHANGED
|
||||
|
||||
elif isinstance(action, raw.types.ChannelAdminLogEventActionExportedInviteEdit):
|
||||
old_invite_link = types.ChatInviteLink._parse(client, action.prev_invite, users)
|
||||
|
Loading…
Reference in New Issue
Block a user