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

New "outgoing" field to easily tell in/out messages apart

This commit is contained in:
Dan 2018-04-25 15:27:16 +02:00
parent 7c2c878333
commit 3e4135c8e1
2 changed files with 10 additions and 1 deletions

View File

@ -475,7 +475,8 @@ def parse_message(
sticker=sticker,
document=document,
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
)
if message.reply_to_msg_id and replies:

View File

@ -177,6 +177,12 @@ class Message(Object):
via_bot (:obj:`User <pyrogram.User>`):
Via bot.
outgoing (``bool``):
Whether the message is incoming or outgoing.
Messages received from other chats are incoming (*outgoing* is False).
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.
matches (``list``):
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>`.
@ -233,6 +239,7 @@ class Message(Object):
connected_website=None,
views: int = None,
via_bot=None,
outgoing: bool = None,
matches: list = None,
command: list = None
):
@ -280,5 +287,6 @@ class Message(Object):
self.connected_website = connected_website # flags.38?string
self.views = views # flags.39?int
self.via_bot = via_bot # flags.40?User
self.outgoing = outgoing
self.matches = matches
self.command = command