mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 12:51:18 +00:00
Rename voice_* related fields to video_*
This commit is contained in:
parent
6b0dca09de
commit
a3c7f5e991
@ -96,7 +96,7 @@ class ChatEventAction(AutoName):
|
||||
# MEMBER_VOLUME_CHANGED = auto()
|
||||
""
|
||||
|
||||
# VOICE_CHAT_STARTED = auto()
|
||||
# VIDEO_CHAT_STARTED = auto()
|
||||
""
|
||||
|
||||
POLL_STOPPED = auto()
|
||||
|
@ -57,14 +57,14 @@ class MessageService(AutoName):
|
||||
GAME_HIGH_SCORE = auto()
|
||||
"Game high score"
|
||||
|
||||
VOICE_CHAT_STARTED = auto()
|
||||
"Voice chat started"
|
||||
VIDEO_CHAT_STARTED = auto()
|
||||
"Video chat started"
|
||||
|
||||
VOICE_CHAT_ENDED = auto()
|
||||
"Voice chat ended"
|
||||
VIDEO_CHAT_ENDED = auto()
|
||||
"Video chat ended"
|
||||
|
||||
VOICE_CHAT_SCHEDULED = auto()
|
||||
"Voice chat scheduled"
|
||||
VIDEO_CHAT_SCHEDULED = auto()
|
||||
"Video chat scheduled"
|
||||
|
||||
VOICE_CHAT_MEMBERS_INVITED = auto()
|
||||
"Voice chat members invited"
|
||||
VIDEO_CHAT_MEMBERS_INVITED = auto()
|
||||
"Video chat members invited"
|
||||
|
@ -636,34 +636,34 @@ via_bot = create(via_bot_filter)
|
||||
|
||||
# endregion
|
||||
|
||||
# region voice_chat_started_filter
|
||||
async def voice_chat_started_filter(_, __, m: Message):
|
||||
return bool(m.voice_chat_started)
|
||||
# region video_chat_started_filter
|
||||
async def video_chat_started_filter(_, __, m: Message):
|
||||
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"""
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
# region voice_chat_ended_filter
|
||||
async def voice_chat_ended_filter(_, __, m: Message):
|
||||
return bool(m.voice_chat_ended)
|
||||
# region video_chat_ended_filter
|
||||
async def video_chat_ended_filter(_, __, m: Message):
|
||||
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"""
|
||||
|
||||
|
||||
# endregion
|
||||
|
||||
# region voice_chat_members_invited_filter
|
||||
async def voice_chat_members_invited_filter(_, __, m: Message):
|
||||
return bool(m.voice_chat_members_invited)
|
||||
# region video_chat_members_invited_filter
|
||||
async def video_chat_members_invited_filter(_, __, m: Message):
|
||||
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"""
|
||||
|
||||
|
||||
@ -680,7 +680,7 @@ service = create(service_filter)
|
||||
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*,
|
||||
*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*.
|
||||
"""
|
||||
|
||||
|
||||
|
@ -273,16 +273,16 @@ class Message(Object, Update):
|
||||
E.g.: "/start 1 2 3" would produce ["start", "1", "2", "3"].
|
||||
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.
|
||||
|
||||
voice_chat_started (:obj:`~pyrogram.types.VoiceChatStarted`, *optional*):
|
||||
video_chat_started (:obj:`~pyrogram.types.VideoChatStarted`, *optional*):
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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,
|
||||
matches: List[Match] = None,
|
||||
command: List[str] = None,
|
||||
voice_chat_scheduled: "types.VoiceChatScheduled" = None,
|
||||
voice_chat_started: "types.VoiceChatStarted" = None,
|
||||
voice_chat_ended: "types.VoiceChatEnded" = None,
|
||||
voice_chat_members_invited: "types.VoiceChatMembersInvited" = None,
|
||||
video_chat_scheduled: "types.VideoChatScheduled" = None,
|
||||
video_chat_started: "types.VideoChatStarted" = None,
|
||||
video_chat_ended: "types.VideoChatEnded" = None,
|
||||
video_chat_members_invited: "types.VideoChatMembersInvited" = None,
|
||||
reply_markup: Union[
|
||||
"types.InlineKeyboardMarkup",
|
||||
"types.ReplyKeyboardMarkup",
|
||||
@ -437,10 +437,10 @@ class Message(Object, Update):
|
||||
self.matches = matches
|
||||
self.command = command
|
||||
self.reply_markup = reply_markup
|
||||
self.voice_chat_scheduled = voice_chat_scheduled
|
||||
self.voice_chat_started = voice_chat_started
|
||||
self.voice_chat_ended = voice_chat_ended
|
||||
self.voice_chat_members_invited = voice_chat_members_invited
|
||||
self.video_chat_scheduled = video_chat_scheduled
|
||||
self.video_chat_started = video_chat_started
|
||||
self.video_chat_ended = video_chat_ended
|
||||
self.video_chat_members_invited = video_chat_members_invited
|
||||
self.reactions = reactions
|
||||
|
||||
@staticmethod
|
||||
@ -487,10 +487,10 @@ class Message(Object, Update):
|
||||
group_chat_created = None
|
||||
channel_chat_created = None
|
||||
new_chat_photo = None
|
||||
voice_chat_scheduled = None
|
||||
voice_chat_started = None
|
||||
voice_chat_ended = None
|
||||
voice_chat_members_invited = None
|
||||
video_chat_scheduled = None
|
||||
video_chat_started = None
|
||||
video_chat_ended = None
|
||||
video_chat_members_invited = None
|
||||
|
||||
service_type = None
|
||||
|
||||
@ -525,18 +525,18 @@ class Message(Object, Update):
|
||||
new_chat_photo = types.Photo._parse(client, action.photo)
|
||||
service_type = enums.MessageService.NEW_CHAT_PHOTO
|
||||
elif isinstance(action, raw.types.MessageActionGroupCallScheduled):
|
||||
voice_chat_scheduled = types.VoiceChatScheduled._parse(action)
|
||||
service_type = enums.MessageService.VOICE_CHAT_SCHEDULED
|
||||
video_chat_scheduled = types.VideoChatScheduled._parse(action)
|
||||
service_type = enums.MessageService.VIDEO_CHAT_SCHEDULED
|
||||
elif isinstance(action, raw.types.MessageActionGroupCall):
|
||||
if action.duration:
|
||||
voice_chat_ended = types.VoiceChatEnded._parse(action)
|
||||
service_type = enums.MessageService.VOICE_CHAT_ENDED
|
||||
video_chat_ended = types.VideoChatEnded._parse(action)
|
||||
service_type = enums.MessageService.VIDEO_CHAT_ENDED
|
||||
else:
|
||||
voice_chat_started = types.VoiceChatStarted()
|
||||
service_type = enums.MessageService.VOICE_CHAT_STARTED
|
||||
video_chat_started = types.VideoChatStarted()
|
||||
service_type = enums.MessageService.VIDEO_CHAT_STARTED
|
||||
elif isinstance(action, raw.types.MessageActionInviteToGroupCall):
|
||||
voice_chat_members_invited = types.VoiceChatMembersInvited._parse(client, action, users)
|
||||
service_type = enums.MessageService.VOICE_CHAT_MEMBERS_INVITED
|
||||
video_chat_members_invited = types.VideoChatMembersInvited._parse(client, action, users)
|
||||
service_type = enums.MessageService.VIDEO_CHAT_MEMBERS_INVITED
|
||||
|
||||
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
|
||||
@ -557,10 +557,10 @@ class Message(Object, Update):
|
||||
migrate_from_chat_id=-migrate_from_chat_id if migrate_from_chat_id else None,
|
||||
group_chat_created=group_chat_created,
|
||||
channel_chat_created=channel_chat_created,
|
||||
voice_chat_scheduled=voice_chat_scheduled,
|
||||
voice_chat_started=voice_chat_started,
|
||||
voice_chat_ended=voice_chat_ended,
|
||||
voice_chat_members_invited=voice_chat_members_invited,
|
||||
video_chat_scheduled=video_chat_scheduled,
|
||||
video_chat_started=video_chat_started,
|
||||
video_chat_ended=video_chat_ended,
|
||||
video_chat_members_invited=video_chat_members_invited,
|
||||
client=client
|
||||
# TODO: supergroup_chat_created
|
||||
)
|
||||
|
@ -33,10 +33,10 @@ from .dialog import Dialog
|
||||
from .invite_link_importer import InviteLinkImporter
|
||||
from .restriction import Restriction
|
||||
from .user import User
|
||||
from .voice_chat_ended import VoiceChatEnded
|
||||
from .voice_chat_members_invited import VoiceChatMembersInvited
|
||||
from .voice_chat_scheduled import VoiceChatScheduled
|
||||
from .voice_chat_started import VoiceChatStarted
|
||||
from .video_chat_ended import VideoChatEnded
|
||||
from .video_chat_members_invited import VideoChatMembersInvited
|
||||
from .video_chat_scheduled import VideoChatScheduled
|
||||
from .video_chat_started import VideoChatStarted
|
||||
|
||||
__all__ = [
|
||||
"Chat",
|
||||
@ -52,11 +52,11 @@ __all__ = [
|
||||
"ChatInviteLink",
|
||||
"InviteLinkImporter",
|
||||
"ChatAdminWithInviteLinks",
|
||||
"VoiceChatStarted",
|
||||
"VoiceChatEnded",
|
||||
"VoiceChatMembersInvited",
|
||||
"VideoChatStarted",
|
||||
"VideoChatEnded",
|
||||
"VideoChatMembersInvited",
|
||||
"ChatMemberUpdated",
|
||||
"VoiceChatScheduled",
|
||||
"VideoChatScheduled",
|
||||
"ChatJoinRequest",
|
||||
"ChatPrivileges",
|
||||
"ChatJoiner"
|
||||
|
@ -20,7 +20,7 @@ from pyrogram import raw
|
||||
from ..object import Object
|
||||
|
||||
|
||||
class VoiceChatEnded(Object):
|
||||
class VideoChatEnded(Object):
|
||||
"""A service message about a voice chat ended in the chat.
|
||||
|
||||
Parameters:
|
||||
@ -37,5 +37,5 @@ class VoiceChatEnded(Object):
|
||||
self.duration = duration
|
||||
|
||||
@staticmethod
|
||||
def _parse(action: "raw.types.MessageActionGroupCall") -> "VoiceChatEnded":
|
||||
return VoiceChatEnded(duration=action.duration)
|
||||
def _parse(action: "raw.types.MessageActionGroupCall") -> "VideoChatEnded":
|
||||
return VideoChatEnded(duration=action.duration)
|
@ -22,7 +22,7 @@ from pyrogram import raw, types
|
||||
from ..object import Object
|
||||
|
||||
|
||||
class VoiceChatMembersInvited(Object):
|
||||
class VideoChatMembersInvited(Object):
|
||||
"""A service message about new members invited to a voice chat.
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ class VoiceChatMembersInvited(Object):
|
||||
client,
|
||||
action: "raw.types.MessageActionInviteToGroupCall",
|
||||
users: Dict[int, "raw.types.User"]
|
||||
) -> "VoiceChatMembersInvited":
|
||||
) -> "VideoChatMembersInvited":
|
||||
users = [types.User._parse(client, users[i]) for i in action.users]
|
||||
|
||||
return VoiceChatMembersInvited(users=users)
|
||||
return VideoChatMembersInvited(users=users)
|
@ -22,7 +22,7 @@ from pyrogram import raw, utils
|
||||
from ..object import Object
|
||||
|
||||
|
||||
class VoiceChatScheduled(Object):
|
||||
class VideoChatScheduled(Object):
|
||||
"""A service message about a voice chat scheduled in the chat.
|
||||
|
||||
Parameters:
|
||||
@ -39,5 +39,5 @@ class VoiceChatScheduled(Object):
|
||||
self.start_date = start_date
|
||||
|
||||
@staticmethod
|
||||
def _parse(action: "raw.types.MessageActionGroupCallScheduled") -> "VoiceChatScheduled":
|
||||
return VoiceChatScheduled(start_date=utils.timestamp_to_datetime(action.schedule_date))
|
||||
def _parse(action: "raw.types.MessageActionGroupCallScheduled") -> "VideoChatScheduled":
|
||||
return VideoChatScheduled(start_date=utils.timestamp_to_datetime(action.schedule_date))
|
@ -19,7 +19,7 @@
|
||||
from ..object import Object
|
||||
|
||||
|
||||
class VoiceChatStarted(Object):
|
||||
class VideoChatStarted(Object):
|
||||
"""A service message about a voice chat started in the chat.
|
||||
|
||||
Currently holds no information.
|
Loading…
Reference in New Issue
Block a user