mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 05:18:10 +00:00
Add client field in Message
This commit is contained in:
parent
bd0fc27a61
commit
dcbce9f9a1
@ -476,7 +476,8 @@ def parse_message(
|
|||||||
document=document,
|
document=document,
|
||||||
views=message.views,
|
views=message.views,
|
||||||
via_bot=parse_user(users.get(message.via_bot_id, None)),
|
via_bot=parse_user(users.get(message.via_bot_id, None)),
|
||||||
outgoing=message.out
|
outgoing=message.out,
|
||||||
|
client=client
|
||||||
)
|
)
|
||||||
|
|
||||||
if message.reply_to_msg_id and replies:
|
if message.reply_to_msg_id and replies:
|
||||||
@ -575,7 +576,8 @@ def parse_message_service(
|
|||||||
migrate_to_chat_id=int("-100" + str(migrate_to_chat_id)) if migrate_to_chat_id else None,
|
migrate_to_chat_id=int("-100" + str(migrate_to_chat_id)) if migrate_to_chat_id else None,
|
||||||
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,
|
||||||
|
client=client
|
||||||
# TODO: supergroup_chat_created
|
# TODO: supergroup_chat_created
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -590,4 +592,4 @@ def parse_message_empty(
|
|||||||
client,
|
client,
|
||||||
message: types.MessageEmpty
|
message: types.MessageEmpty
|
||||||
) -> pyrogram_types.Message:
|
) -> pyrogram_types.Message:
|
||||||
return pyrogram_types.Message(message_id=message.id)
|
return pyrogram_types.Message(message_id=message.id, client=client)
|
||||||
|
@ -30,6 +30,9 @@ class Message(Object):
|
|||||||
Args:
|
Args:
|
||||||
message_id (``int``):
|
message_id (``int``):
|
||||||
Unique message identifier inside this chat.
|
Unique message identifier inside this chat.
|
||||||
|
|
||||||
|
client (:obj:`Client <pyrogram.Client>`, *optional*):
|
||||||
|
The client instance this message is bound to.
|
||||||
|
|
||||||
date (``int``, *optional*):
|
date (``int``, *optional*):
|
||||||
Date the message was sent in Unix time.
|
Date the message was sent in Unix time.
|
||||||
@ -177,17 +180,17 @@ class Message(Object):
|
|||||||
via_bot (:obj:`User <pyrogram.User>`):
|
via_bot (:obj:`User <pyrogram.User>`):
|
||||||
Via bot.
|
Via bot.
|
||||||
|
|
||||||
outgoing (``bool``):
|
outgoing (``bool``, *optional*):
|
||||||
Whether the message is incoming or outgoing.
|
Whether the message is incoming or outgoing.
|
||||||
Messages received from other chats are incoming (*outgoing* is False).
|
Messages received from other chats are incoming (*outgoing* is False).
|
||||||
Messages sent from yourself to other chats are outgoing (*outgoing* is True).
|
Messages sent from yourself to other chats are outgoing (*outgoing* is True).
|
||||||
An exception is made for your own personal chat; messages sent there will be incoming.
|
An exception is made for your own personal chat; messages sent there will be incoming.
|
||||||
|
|
||||||
matches (``list``):
|
matches (``list``, *optional*):
|
||||||
A list containing all `Match Objects <https://docs.python.org/3/library/re.html#match-objects>`_ that match
|
A list containing all `Match Objects <https://docs.python.org/3/library/re.html#match-objects>`_ that match
|
||||||
the text of this message. Only applicable when using :obj:`Filters.regex <pyrogram.Filters.regex>`.
|
the text of this message. Only applicable when using :obj:`Filters.regex <pyrogram.Filters.regex>`.
|
||||||
|
|
||||||
command (``list``):
|
command (``list``, *optional*):
|
||||||
A list containing the command and its arguments, if any.
|
A list containing the command and its arguments, if any.
|
||||||
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:`Filters.command <pyrogram.Filters.command>`.
|
Only applicable when using :obj:`Filters.command <pyrogram.Filters.command>`.
|
||||||
@ -196,6 +199,7 @@ class Message(Object):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
message_id: int,
|
message_id: int,
|
||||||
|
client=None,
|
||||||
date: int = None,
|
date: int = None,
|
||||||
chat=None,
|
chat=None,
|
||||||
from_user=None,
|
from_user=None,
|
||||||
@ -244,6 +248,7 @@ class Message(Object):
|
|||||||
command: list = None
|
command: list = None
|
||||||
):
|
):
|
||||||
self.message_id = message_id # int
|
self.message_id = message_id # int
|
||||||
|
self.client = client
|
||||||
self.date = date # int
|
self.date = date # int
|
||||||
self.chat = chat # Chat
|
self.chat = chat # Chat
|
||||||
self.from_user = from_user # flags.0?User
|
self.from_user = from_user # flags.0?User
|
||||||
|
Loading…
x
Reference in New Issue
Block a user