mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-27 16:45:19 +00:00
Add requested_chat to service messages
This commit is contained in:
parent
9f10b554f1
commit
af4cb18e30
@ -98,3 +98,6 @@ class MessageServiceType(AutoName):
|
|||||||
|
|
||||||
WEB_APP_DATA = auto()
|
WEB_APP_DATA = auto()
|
||||||
"Web app data"
|
"Web app data"
|
||||||
|
|
||||||
|
REQUESTED_CHAT = auto()
|
||||||
|
"Requested chat"
|
||||||
|
@ -352,6 +352,9 @@ class Message(Object, Update):
|
|||||||
gift_code (:obj:`~pyrogram.types.GiftCode`, *optional*):
|
gift_code (:obj:`~pyrogram.types.GiftCode`, *optional*):
|
||||||
Service message: gift code information.
|
Service message: gift code information.
|
||||||
|
|
||||||
|
requested_chat (:obj:`~pyrogram.types.Chat`, *optional*):
|
||||||
|
Service message: requested chat information.
|
||||||
|
|
||||||
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*):
|
||||||
Additional interface options. An object for an inline keyboard, custom reply keyboard,
|
Additional interface options. An object for an inline keyboard, custom reply keyboard,
|
||||||
instructions to remove reply keyboard or to force a reply from the user.
|
instructions to remove reply keyboard or to force a reply from the user.
|
||||||
@ -454,6 +457,7 @@ class Message(Object, Update):
|
|||||||
video_chat_members_invited: "types.VideoChatMembersInvited" = None,
|
video_chat_members_invited: "types.VideoChatMembersInvited" = None,
|
||||||
web_app_data: "types.WebAppData" = None,
|
web_app_data: "types.WebAppData" = None,
|
||||||
gift_code: "types.GiftCode" = None,
|
gift_code: "types.GiftCode" = None,
|
||||||
|
requested_chat: "types.Chat" = None,
|
||||||
giveaway_launched: bool = None,
|
giveaway_launched: bool = None,
|
||||||
reply_markup: Union[
|
reply_markup: Union[
|
||||||
"types.InlineKeyboardMarkup",
|
"types.InlineKeyboardMarkup",
|
||||||
@ -551,6 +555,7 @@ class Message(Object, Update):
|
|||||||
self.video_chat_members_invited = video_chat_members_invited
|
self.video_chat_members_invited = video_chat_members_invited
|
||||||
self.web_app_data = web_app_data
|
self.web_app_data = web_app_data
|
||||||
self.gift_code = gift_code
|
self.gift_code = gift_code
|
||||||
|
self.requested_chat = requested_chat
|
||||||
self.giveaway_launched = giveaway_launched
|
self.giveaway_launched = giveaway_launched
|
||||||
self.reactions = reactions
|
self.reactions = reactions
|
||||||
|
|
||||||
@ -614,6 +619,7 @@ class Message(Object, Update):
|
|||||||
web_app_data = None
|
web_app_data = None
|
||||||
gift_code = None
|
gift_code = None
|
||||||
giveaway_launched = None
|
giveaway_launched = None
|
||||||
|
requested_chat = None
|
||||||
|
|
||||||
service_type = None
|
service_type = None
|
||||||
|
|
||||||
@ -692,7 +698,17 @@ class Message(Object, Update):
|
|||||||
elif isinstance(action, raw.types.MessageActionGiftCode):
|
elif isinstance(action, raw.types.MessageActionGiftCode):
|
||||||
gift_code = types.GiftCode._parse(client, action, chats)
|
gift_code = types.GiftCode._parse(client, action, chats)
|
||||||
service_type = enums.MessageServiceType.GIFT_CODE
|
service_type = enums.MessageServiceType.GIFT_CODE
|
||||||
|
elif isinstance(action, raw.types.MessageActionRequestedPeer):
|
||||||
|
chat_id = utils.get_raw_peer_id(message.action.peer)
|
||||||
|
|
||||||
|
if isinstance(message.peer_id, raw.types.PeerUser):
|
||||||
|
requested_chat = types.Chat._parse_user_chat(client, users[chat_id])
|
||||||
|
|
||||||
|
if isinstance(message.peer_id, raw.types.PeerChat):
|
||||||
|
requested_chat = types.Chat._parse_chat_chat(client, chats[chat_id])
|
||||||
|
|
||||||
|
requested_chat = types.Chat._parse_channel_chat(client, chats[chat_id])
|
||||||
|
service_type = enums.MessageServiceType.REQUESTED_CHAT
|
||||||
|
|
||||||
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
|
||||||
@ -728,6 +744,7 @@ class Message(Object, Update):
|
|||||||
web_app_data=web_app_data,
|
web_app_data=web_app_data,
|
||||||
giveaway_launched=giveaway_launched,
|
giveaway_launched=giveaway_launched,
|
||||||
gift_code=gift_code,
|
gift_code=gift_code,
|
||||||
|
requested_chat=requested_chat,
|
||||||
client=client
|
client=client
|
||||||
# TODO: supergroup_chat_created
|
# TODO: supergroup_chat_created
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user