2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 05:18:10 +00:00

Rename voice_* related fields to video_*

This commit is contained in:
Dan 2022-04-24 11:56:07 +02:00
parent 6b0dca09de
commit a3c7f5e991
9 changed files with 68 additions and 68 deletions

View File

@ -96,7 +96,7 @@ class ChatEventAction(AutoName):
# MEMBER_VOLUME_CHANGED = auto() # MEMBER_VOLUME_CHANGED = auto()
"" ""
# VOICE_CHAT_STARTED = auto() # VIDEO_CHAT_STARTED = auto()
"" ""
POLL_STOPPED = auto() POLL_STOPPED = auto()

View File

@ -57,14 +57,14 @@ class MessageService(AutoName):
GAME_HIGH_SCORE = auto() GAME_HIGH_SCORE = auto()
"Game high score" "Game high score"
VOICE_CHAT_STARTED = auto() VIDEO_CHAT_STARTED = auto()
"Voice chat started" "Video chat started"
VOICE_CHAT_ENDED = auto() VIDEO_CHAT_ENDED = auto()
"Voice chat ended" "Video chat ended"
VOICE_CHAT_SCHEDULED = auto() VIDEO_CHAT_SCHEDULED = auto()
"Voice chat scheduled" "Video chat scheduled"
VOICE_CHAT_MEMBERS_INVITED = auto() VIDEO_CHAT_MEMBERS_INVITED = auto()
"Voice chat members invited" "Video chat members invited"

View File

@ -636,34 +636,34 @@ via_bot = create(via_bot_filter)
# endregion # endregion
# region voice_chat_started_filter # region video_chat_started_filter
async def voice_chat_started_filter(_, __, m: Message): async def video_chat_started_filter(_, __, m: Message):
return bool(m.voice_chat_started) return bool(m.video_chat_started)
voice_chat_started = create(voice_chat_started_filter) video_chat_started = create(video_chat_started_filter)
"""Filter messages for started voice chats""" """Filter messages for started voice chats"""
# endregion # endregion
# region voice_chat_ended_filter # region video_chat_ended_filter
async def voice_chat_ended_filter(_, __, m: Message): async def video_chat_ended_filter(_, __, m: Message):
return bool(m.voice_chat_ended) return bool(m.video_chat_ended)
voice_chat_ended = create(voice_chat_ended_filter) video_chat_ended = create(video_chat_ended_filter)
"""Filter messages for ended voice chats""" """Filter messages for ended voice chats"""
# endregion # endregion
# region voice_chat_members_invited_filter # region video_chat_members_invited_filter
async def voice_chat_members_invited_filter(_, __, m: Message): async def video_chat_members_invited_filter(_, __, m: Message):
return bool(m.voice_chat_members_invited) return bool(m.video_chat_members_invited)
voice_chat_members_invited = create(voice_chat_members_invited_filter) video_chat_members_invited = create(video_chat_members_invited_filter)
"""Filter messages for voice chat invited members""" """Filter messages for voice chat invited members"""
@ -680,7 +680,7 @@ service = create(service_filter)
A service message contains any of the following fields set: *left_chat_member*, A service message contains any of the following fields set: *left_chat_member*,
*new_chat_title*, *new_chat_photo*, *delete_chat_photo*, *group_chat_created*, *supergroup_chat_created*, *new_chat_title*, *new_chat_photo*, *delete_chat_photo*, *group_chat_created*, *supergroup_chat_created*,
*channel_chat_created*, *migrate_to_chat_id*, *migrate_from_chat_id*, *pinned_message*, *game_score*, *channel_chat_created*, *migrate_to_chat_id*, *migrate_from_chat_id*, *pinned_message*, *game_score*,
*voice_chat_started*, *voice_chat_ended*, *voice_chat_members_invited*. *video_chat_started*, *video_chat_ended*, *video_chat_members_invited*.
""" """

View File

@ -273,16 +273,16 @@ class Message(Object, Update):
E.g.: "/start 1 2 3" would produce ["start", "1", "2", "3"]. E.g.: "/start 1 2 3" would produce ["start", "1", "2", "3"].
Only applicable when using :obj:`~pyrogram.filters.command`. Only applicable when using :obj:`~pyrogram.filters.command`.
voice_chat_scheduled (:obj:`~pyrogram.types.VoiceChatScheduled`, *optional*): video_chat_scheduled (:obj:`~pyrogram.types.VideoChatScheduled`, *optional*):
Service message: voice chat scheduled. Service message: voice chat scheduled.
voice_chat_started (:obj:`~pyrogram.types.VoiceChatStarted`, *optional*): video_chat_started (:obj:`~pyrogram.types.VideoChatStarted`, *optional*):
Service message: the voice chat started. Service message: the voice chat started.
voice_chat_ended (:obj:`~pyrogram.types.VoiceChatEnded`, *optional*): video_chat_ended (:obj:`~pyrogram.types.VideoChatEnded`, *optional*):
Service message: the voice chat has ended. Service message: the voice chat has ended.
voice_chat_members_invited (:obj:`~pyrogram.types.VoiceChatParticipantsInvited`, *optional*): video_chat_members_invited (:obj:`~pyrogram.types.VoiceChatParticipantsInvited`, *optional*):
Service message: new members were invited to the voice chat. Service message: new members were invited to the voice chat.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
@ -362,10 +362,10 @@ class Message(Object, Update):
outgoing: bool = None, outgoing: bool = None,
matches: List[Match] = None, matches: List[Match] = None,
command: List[str] = None, command: List[str] = None,
voice_chat_scheduled: "types.VoiceChatScheduled" = None, video_chat_scheduled: "types.VideoChatScheduled" = None,
voice_chat_started: "types.VoiceChatStarted" = None, video_chat_started: "types.VideoChatStarted" = None,
voice_chat_ended: "types.VoiceChatEnded" = None, video_chat_ended: "types.VideoChatEnded" = None,
voice_chat_members_invited: "types.VoiceChatMembersInvited" = None, video_chat_members_invited: "types.VideoChatMembersInvited" = None,
reply_markup: Union[ reply_markup: Union[
"types.InlineKeyboardMarkup", "types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup", "types.ReplyKeyboardMarkup",
@ -437,10 +437,10 @@ class Message(Object, Update):
self.matches = matches self.matches = matches
self.command = command self.command = command
self.reply_markup = reply_markup self.reply_markup = reply_markup
self.voice_chat_scheduled = voice_chat_scheduled self.video_chat_scheduled = video_chat_scheduled
self.voice_chat_started = voice_chat_started self.video_chat_started = video_chat_started
self.voice_chat_ended = voice_chat_ended self.video_chat_ended = video_chat_ended
self.voice_chat_members_invited = voice_chat_members_invited self.video_chat_members_invited = video_chat_members_invited
self.reactions = reactions self.reactions = reactions
@staticmethod @staticmethod
@ -487,10 +487,10 @@ class Message(Object, Update):
group_chat_created = None group_chat_created = None
channel_chat_created = None channel_chat_created = None
new_chat_photo = None new_chat_photo = None
voice_chat_scheduled = None video_chat_scheduled = None
voice_chat_started = None video_chat_started = None
voice_chat_ended = None video_chat_ended = None
voice_chat_members_invited = None video_chat_members_invited = None
service_type = None service_type = None
@ -525,18 +525,18 @@ class Message(Object, Update):
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.MessageService.NEW_CHAT_PHOTO
elif isinstance(action, raw.types.MessageActionGroupCallScheduled): elif isinstance(action, raw.types.MessageActionGroupCallScheduled):
voice_chat_scheduled = types.VoiceChatScheduled._parse(action) video_chat_scheduled = types.VideoChatScheduled._parse(action)
service_type = enums.MessageService.VOICE_CHAT_SCHEDULED service_type = enums.MessageService.VIDEO_CHAT_SCHEDULED
elif isinstance(action, raw.types.MessageActionGroupCall): elif isinstance(action, raw.types.MessageActionGroupCall):
if action.duration: if action.duration:
voice_chat_ended = types.VoiceChatEnded._parse(action) video_chat_ended = types.VideoChatEnded._parse(action)
service_type = enums.MessageService.VOICE_CHAT_ENDED service_type = enums.MessageService.VIDEO_CHAT_ENDED
else: else:
voice_chat_started = types.VoiceChatStarted() video_chat_started = types.VideoChatStarted()
service_type = enums.MessageService.VOICE_CHAT_STARTED service_type = enums.MessageService.VIDEO_CHAT_STARTED
elif isinstance(action, raw.types.MessageActionInviteToGroupCall): elif isinstance(action, raw.types.MessageActionInviteToGroupCall):
voice_chat_members_invited = types.VoiceChatMembersInvited._parse(client, action, users) video_chat_members_invited = types.VideoChatMembersInvited._parse(client, action, users)
service_type = enums.MessageService.VOICE_CHAT_MEMBERS_INVITED service_type = enums.MessageService.VIDEO_CHAT_MEMBERS_INVITED
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
@ -557,10 +557,10 @@ class Message(Object, Update):
migrate_from_chat_id=-migrate_from_chat_id if migrate_from_chat_id else None, migrate_from_chat_id=-migrate_from_chat_id if migrate_from_chat_id else None,
group_chat_created=group_chat_created, group_chat_created=group_chat_created,
channel_chat_created=channel_chat_created, channel_chat_created=channel_chat_created,
voice_chat_scheduled=voice_chat_scheduled, video_chat_scheduled=video_chat_scheduled,
voice_chat_started=voice_chat_started, video_chat_started=video_chat_started,
voice_chat_ended=voice_chat_ended, video_chat_ended=video_chat_ended,
voice_chat_members_invited=voice_chat_members_invited, video_chat_members_invited=video_chat_members_invited,
client=client client=client
# TODO: supergroup_chat_created # TODO: supergroup_chat_created
) )

View File

@ -33,10 +33,10 @@ from .dialog import Dialog
from .invite_link_importer import InviteLinkImporter from .invite_link_importer import InviteLinkImporter
from .restriction import Restriction from .restriction import Restriction
from .user import User from .user import User
from .voice_chat_ended import VoiceChatEnded from .video_chat_ended import VideoChatEnded
from .voice_chat_members_invited import VoiceChatMembersInvited from .video_chat_members_invited import VideoChatMembersInvited
from .voice_chat_scheduled import VoiceChatScheduled from .video_chat_scheduled import VideoChatScheduled
from .voice_chat_started import VoiceChatStarted from .video_chat_started import VideoChatStarted
__all__ = [ __all__ = [
"Chat", "Chat",
@ -52,11 +52,11 @@ __all__ = [
"ChatInviteLink", "ChatInviteLink",
"InviteLinkImporter", "InviteLinkImporter",
"ChatAdminWithInviteLinks", "ChatAdminWithInviteLinks",
"VoiceChatStarted", "VideoChatStarted",
"VoiceChatEnded", "VideoChatEnded",
"VoiceChatMembersInvited", "VideoChatMembersInvited",
"ChatMemberUpdated", "ChatMemberUpdated",
"VoiceChatScheduled", "VideoChatScheduled",
"ChatJoinRequest", "ChatJoinRequest",
"ChatPrivileges", "ChatPrivileges",
"ChatJoiner" "ChatJoiner"

View File

@ -20,7 +20,7 @@ from pyrogram import raw
from ..object import Object from ..object import Object
class VoiceChatEnded(Object): class VideoChatEnded(Object):
"""A service message about a voice chat ended in the chat. """A service message about a voice chat ended in the chat.
Parameters: Parameters:
@ -37,5 +37,5 @@ class VoiceChatEnded(Object):
self.duration = duration self.duration = duration
@staticmethod @staticmethod
def _parse(action: "raw.types.MessageActionGroupCall") -> "VoiceChatEnded": def _parse(action: "raw.types.MessageActionGroupCall") -> "VideoChatEnded":
return VoiceChatEnded(duration=action.duration) return VideoChatEnded(duration=action.duration)

View File

@ -22,7 +22,7 @@ from pyrogram import raw, types
from ..object import Object from ..object import Object
class VoiceChatMembersInvited(Object): class VideoChatMembersInvited(Object):
"""A service message about new members invited to a voice chat. """A service message about new members invited to a voice chat.
@ -44,7 +44,7 @@ class VoiceChatMembersInvited(Object):
client, client,
action: "raw.types.MessageActionInviteToGroupCall", action: "raw.types.MessageActionInviteToGroupCall",
users: Dict[int, "raw.types.User"] users: Dict[int, "raw.types.User"]
) -> "VoiceChatMembersInvited": ) -> "VideoChatMembersInvited":
users = [types.User._parse(client, users[i]) for i in action.users] users = [types.User._parse(client, users[i]) for i in action.users]
return VoiceChatMembersInvited(users=users) return VideoChatMembersInvited(users=users)

View File

@ -22,7 +22,7 @@ from pyrogram import raw, utils
from ..object import Object from ..object import Object
class VoiceChatScheduled(Object): class VideoChatScheduled(Object):
"""A service message about a voice chat scheduled in the chat. """A service message about a voice chat scheduled in the chat.
Parameters: Parameters:
@ -39,5 +39,5 @@ class VoiceChatScheduled(Object):
self.start_date = start_date self.start_date = start_date
@staticmethod @staticmethod
def _parse(action: "raw.types.MessageActionGroupCallScheduled") -> "VoiceChatScheduled": def _parse(action: "raw.types.MessageActionGroupCallScheduled") -> "VideoChatScheduled":
return VoiceChatScheduled(start_date=utils.timestamp_to_datetime(action.schedule_date)) return VideoChatScheduled(start_date=utils.timestamp_to_datetime(action.schedule_date))

View File

@ -19,7 +19,7 @@
from ..object import Object from ..object import Object
class VoiceChatStarted(Object): class VideoChatStarted(Object):
"""A service message about a voice chat started in the chat. """A service message about a voice chat started in the chat.
Currently holds no information. Currently holds no information.