mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-27 16:45:19 +00:00
Add custom_action to service messages
This commit is contained in:
parent
71a5719219
commit
ad4f6db102
@ -24,6 +24,9 @@ from .auto_name import AutoName
|
||||
class MessageServiceType(AutoName):
|
||||
"""Message service type enumeration used in :obj:`~pyrogram.types.Message`."""
|
||||
|
||||
CUSTOM_ACTION = auto()
|
||||
"Custom action"
|
||||
|
||||
NEW_CHAT_MEMBERS = auto()
|
||||
"New members join"
|
||||
|
||||
|
@ -588,6 +588,7 @@ class Message(Object, Update):
|
||||
message_thread_id = None
|
||||
action = message.action
|
||||
|
||||
text = None
|
||||
new_chat_members = None
|
||||
left_chat_member = None
|
||||
new_chat_title = None
|
||||
@ -643,6 +644,9 @@ class Message(Object, Update):
|
||||
elif isinstance(action, raw.types.MessageActionChatEditPhoto):
|
||||
new_chat_photo = types.Photo._parse(client, action.photo)
|
||||
service_type = enums.MessageServiceType.NEW_CHAT_PHOTO
|
||||
elif isinstance(action, raw.types.MessageActionCustomAction):
|
||||
text = message.action.message
|
||||
service_type = enums.MessageServiceType.CUSTOM_ACTION
|
||||
elif isinstance(action, raw.types.MessageActionTopicCreate):
|
||||
forum_topic_created = types.ForumTopicCreated._parse(message)
|
||||
service_type = enums.MessageServiceType.FORUM_TOPIC_CREATED
|
||||
@ -695,6 +699,7 @@ class Message(Object, Update):
|
||||
from_user=from_user,
|
||||
sender_chat=sender_chat,
|
||||
service=service_type,
|
||||
text=text,
|
||||
new_chat_members=new_chat_members,
|
||||
left_chat_member=left_chat_member,
|
||||
new_chat_title=new_chat_title,
|
||||
|
Loading…
Reference in New Issue
Block a user