diff --git a/pyrogram/enums/message_service_type.py b/pyrogram/enums/message_service_type.py index f0660ab1..10e020d7 100644 --- a/pyrogram/enums/message_service_type.py +++ b/pyrogram/enums/message_service_type.py @@ -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" diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index 0b0bd233..0c4313bb 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -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,