mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-30 22:05:28 +00:00
Rename enum MessageService to MessageServiceType
This commit is contained in:
@@ -1,8 +0,0 @@
|
|||||||
MessageService
|
|
||||||
==============
|
|
||||||
|
|
||||||
.. autoclass:: pyrogram.enums.MessageService()
|
|
||||||
:members:
|
|
||||||
|
|
||||||
.. raw:: html
|
|
||||||
:file: ./cleanup.html
|
|
8
docs/source/api/enums/MessageServiceType.rst
Normal file
8
docs/source/api/enums/MessageServiceType.rst
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
MessageServiceType
|
||||||
|
==================
|
||||||
|
|
||||||
|
.. autoclass:: pyrogram.enums.MessageServiceType()
|
||||||
|
:members:
|
||||||
|
|
||||||
|
.. raw:: html
|
||||||
|
:file: ./cleanup.html
|
@@ -20,7 +20,7 @@ to apply only a valid value among the expected ones.
|
|||||||
ChatType
|
ChatType
|
||||||
MessageEntityType
|
MessageEntityType
|
||||||
MessageMediaType
|
MessageMediaType
|
||||||
MessageService
|
MessageServiceType
|
||||||
MessagesFilter
|
MessagesFilter
|
||||||
ParseMode
|
ParseMode
|
||||||
PollType
|
PollType
|
||||||
@@ -38,7 +38,7 @@ to apply only a valid value among the expected ones.
|
|||||||
ChatType
|
ChatType
|
||||||
MessageEntityType
|
MessageEntityType
|
||||||
MessageMediaType
|
MessageMediaType
|
||||||
MessageService
|
MessageServiceType
|
||||||
MessagesFilter
|
MessagesFilter
|
||||||
ParseMode
|
ParseMode
|
||||||
PollType
|
PollType
|
||||||
|
@@ -23,7 +23,7 @@ from .chat_members_filter import ChatMembersFilter
|
|||||||
from .chat_type import ChatType
|
from .chat_type import ChatType
|
||||||
from .message_entity_type import MessageEntityType
|
from .message_entity_type import MessageEntityType
|
||||||
from .message_media_type import MessageMediaType
|
from .message_media_type import MessageMediaType
|
||||||
from .message_service import MessageService
|
from .message_service_type import MessageServiceType
|
||||||
from .messages_filter import MessagesFilter
|
from .messages_filter import MessagesFilter
|
||||||
from .next_code_type import NextCodeType
|
from .next_code_type import NextCodeType
|
||||||
from .parse_mode import ParseMode
|
from .parse_mode import ParseMode
|
||||||
|
@@ -21,8 +21,8 @@ from enum import auto
|
|||||||
from .auto_name import AutoName
|
from .auto_name import AutoName
|
||||||
|
|
||||||
|
|
||||||
class MessageService(AutoName):
|
class MessageServiceType(AutoName):
|
||||||
"""Message service enumeration used in :obj:`~pyrogram.types.Message`."""
|
"""Message service type enumeration used in :obj:`~pyrogram.types.Message`."""
|
||||||
|
|
||||||
NEW_CHAT_MEMBERS = auto()
|
NEW_CHAT_MEMBERS = auto()
|
||||||
"New members join"
|
"New members join"
|
@@ -113,7 +113,7 @@ class Message(Object, Update):
|
|||||||
The message is empty.
|
The message is empty.
|
||||||
A message can be empty in case it was deleted or you tried to retrieve a message that doesn't exist yet.
|
A message can be empty in case it was deleted or you tried to retrieve a message that doesn't exist yet.
|
||||||
|
|
||||||
service (:obj:`~pyrogram.enums.MessageService`, *optional*):
|
service (:obj:`~pyrogram.enums.MessageServiceType`, *optional*):
|
||||||
The message is a service message.
|
The message is a service message.
|
||||||
This field will contain the enumeration type of the service message.
|
This field will contain the enumeration type of the service message.
|
||||||
You can use ``service = getattr(message, message.service.value)`` to access the service message.
|
You can use ``service = getattr(message, message.service.value)`` to access the service message.
|
||||||
@@ -321,10 +321,10 @@ class Message(Object, Update):
|
|||||||
reply_to_message: "Message" = None,
|
reply_to_message: "Message" = None,
|
||||||
mentioned: bool = None,
|
mentioned: bool = None,
|
||||||
empty: bool = None,
|
empty: bool = None,
|
||||||
service: "enums.MessageService" = None,
|
service: "enums.MessageServiceType" = None,
|
||||||
scheduled: bool = None,
|
scheduled: bool = None,
|
||||||
from_scheduled: bool = None,
|
from_scheduled: bool = None,
|
||||||
media: str = None,
|
media: "enums.MessageMediaType" = None,
|
||||||
edit_date: datetime = None,
|
edit_date: datetime = None,
|
||||||
media_group_id: str = None,
|
media_group_id: str = None,
|
||||||
author_signature: str = None,
|
author_signature: str = None,
|
||||||
@@ -502,50 +502,50 @@ class Message(Object, Update):
|
|||||||
|
|
||||||
if isinstance(action, raw.types.MessageActionChatAddUser):
|
if isinstance(action, raw.types.MessageActionChatAddUser):
|
||||||
new_chat_members = [types.User._parse(client, users[i]) for i in action.users]
|
new_chat_members = [types.User._parse(client, users[i]) for i in action.users]
|
||||||
service_type = enums.MessageService.NEW_CHAT_MEMBERS
|
service_type = enums.MessageServiceType.NEW_CHAT_MEMBERS
|
||||||
elif isinstance(action, raw.types.MessageActionChatJoinedByLink):
|
elif isinstance(action, raw.types.MessageActionChatJoinedByLink):
|
||||||
new_chat_members = [types.User._parse(client, users[utils.get_raw_peer_id(message.from_id)])]
|
new_chat_members = [types.User._parse(client, users[utils.get_raw_peer_id(message.from_id)])]
|
||||||
service_type = enums.MessageService.NEW_CHAT_MEMBERS
|
service_type = enums.MessageServiceType.NEW_CHAT_MEMBERS
|
||||||
elif isinstance(action, raw.types.MessageActionChatDeleteUser):
|
elif isinstance(action, raw.types.MessageActionChatDeleteUser):
|
||||||
left_chat_member = types.User._parse(client, users[action.user_id])
|
left_chat_member = types.User._parse(client, users[action.user_id])
|
||||||
service_type = enums.MessageService.LEFT_CHAT_MEMBERS
|
service_type = enums.MessageServiceType.LEFT_CHAT_MEMBERS
|
||||||
elif isinstance(action, raw.types.MessageActionChatEditTitle):
|
elif isinstance(action, raw.types.MessageActionChatEditTitle):
|
||||||
new_chat_title = action.title
|
new_chat_title = action.title
|
||||||
service_type = enums.MessageService.NEW_CHAT_TITLE
|
service_type = enums.MessageServiceType.NEW_CHAT_TITLE
|
||||||
elif isinstance(action, raw.types.MessageActionChatDeletePhoto):
|
elif isinstance(action, raw.types.MessageActionChatDeletePhoto):
|
||||||
delete_chat_photo = True
|
delete_chat_photo = True
|
||||||
service_type = enums.MessageService.DELETE_CHAT_PHOTO
|
service_type = enums.MessageServiceType.DELETE_CHAT_PHOTO
|
||||||
elif isinstance(action, raw.types.MessageActionChatMigrateTo):
|
elif isinstance(action, raw.types.MessageActionChatMigrateTo):
|
||||||
migrate_to_chat_id = action.channel_id
|
migrate_to_chat_id = action.channel_id
|
||||||
service_type = enums.MessageService.MIGRATE_TO_CHAT_ID
|
service_type = enums.MessageServiceType.MIGRATE_TO_CHAT_ID
|
||||||
elif isinstance(action, raw.types.MessageActionChannelMigrateFrom):
|
elif isinstance(action, raw.types.MessageActionChannelMigrateFrom):
|
||||||
migrate_from_chat_id = action.chat_id
|
migrate_from_chat_id = action.chat_id
|
||||||
service_type = enums.MessageService.MIGRATE_FROM_CHAT_ID
|
service_type = enums.MessageServiceType.MIGRATE_FROM_CHAT_ID
|
||||||
elif isinstance(action, raw.types.MessageActionChatCreate):
|
elif isinstance(action, raw.types.MessageActionChatCreate):
|
||||||
group_chat_created = True
|
group_chat_created = True
|
||||||
service_type = enums.MessageService.GROUP_CHAT_CREATED
|
service_type = enums.MessageServiceType.GROUP_CHAT_CREATED
|
||||||
elif isinstance(action, raw.types.MessageActionChannelCreate):
|
elif isinstance(action, raw.types.MessageActionChannelCreate):
|
||||||
channel_chat_created = True
|
channel_chat_created = True
|
||||||
service_type = enums.MessageService.CHANNEL_CHAT_CREATED
|
service_type = enums.MessageServiceType.CHANNEL_CHAT_CREATED
|
||||||
elif isinstance(action, raw.types.MessageActionChatEditPhoto):
|
elif isinstance(action, raw.types.MessageActionChatEditPhoto):
|
||||||
new_chat_photo = types.Photo._parse(client, action.photo)
|
new_chat_photo = types.Photo._parse(client, action.photo)
|
||||||
service_type = enums.MessageService.NEW_CHAT_PHOTO
|
service_type = enums.MessageServiceType.NEW_CHAT_PHOTO
|
||||||
elif isinstance(action, raw.types.MessageActionGroupCallScheduled):
|
elif isinstance(action, raw.types.MessageActionGroupCallScheduled):
|
||||||
video_chat_scheduled = types.VideoChatScheduled._parse(action)
|
video_chat_scheduled = types.VideoChatScheduled._parse(action)
|
||||||
service_type = enums.MessageService.VIDEO_CHAT_SCHEDULED
|
service_type = enums.MessageServiceType.VIDEO_CHAT_SCHEDULED
|
||||||
elif isinstance(action, raw.types.MessageActionGroupCall):
|
elif isinstance(action, raw.types.MessageActionGroupCall):
|
||||||
if action.duration:
|
if action.duration:
|
||||||
video_chat_ended = types.VideoChatEnded._parse(action)
|
video_chat_ended = types.VideoChatEnded._parse(action)
|
||||||
service_type = enums.MessageService.VIDEO_CHAT_ENDED
|
service_type = enums.MessageServiceType.VIDEO_CHAT_ENDED
|
||||||
else:
|
else:
|
||||||
video_chat_started = types.VideoChatStarted()
|
video_chat_started = types.VideoChatStarted()
|
||||||
service_type = enums.MessageService.VIDEO_CHAT_STARTED
|
service_type = enums.MessageServiceType.VIDEO_CHAT_STARTED
|
||||||
elif isinstance(action, raw.types.MessageActionInviteToGroupCall):
|
elif isinstance(action, raw.types.MessageActionInviteToGroupCall):
|
||||||
video_chat_members_invited = types.VideoChatMembersInvited._parse(client, action, users)
|
video_chat_members_invited = types.VideoChatMembersInvited._parse(client, action, users)
|
||||||
service_type = enums.MessageService.VIDEO_CHAT_MEMBERS_INVITED
|
service_type = enums.MessageServiceType.VIDEO_CHAT_MEMBERS_INVITED
|
||||||
elif isinstance(action, raw.types.MessageActionWebViewDataSentMe):
|
elif isinstance(action, raw.types.MessageActionWebViewDataSentMe):
|
||||||
web_app_data = types.WebAppData._parse(action)
|
web_app_data = types.WebAppData._parse(action)
|
||||||
service_type = enums.MessageService.WEB_APP_DATA
|
service_type = enums.MessageServiceType.WEB_APP_DATA
|
||||||
|
|
||||||
from_user = types.User._parse(client, users.get(user_id, None))
|
from_user = types.User._parse(client, users.get(user_id, None))
|
||||||
sender_chat = types.Chat._parse(client, message, users, chats, is_chat=False) if not from_user else None
|
sender_chat = types.Chat._parse(client, message, users, chats, is_chat=False) if not from_user else None
|
||||||
@@ -583,7 +583,7 @@ class Message(Object, Update):
|
|||||||
replies=0
|
replies=0
|
||||||
)
|
)
|
||||||
|
|
||||||
parsed_message.service = enums.MessageService.PINNED_MESSAGE
|
parsed_message.service = enums.MessageServiceType.PINNED_MESSAGE
|
||||||
except MessageIdsEmpty:
|
except MessageIdsEmpty:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -598,7 +598,7 @@ class Message(Object, Update):
|
|||||||
replies=0
|
replies=0
|
||||||
)
|
)
|
||||||
|
|
||||||
parsed_message.service = enums.MessageService.GAME_HIGH_SCORE
|
parsed_message.service = enums.MessageServiceType.GAME_HIGH_SCORE
|
||||||
except MessageIdsEmpty:
|
except MessageIdsEmpty:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user