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

Type hint Message

This commit is contained in:
Dan 2018-12-19 12:30:25 +01:00
parent a8599efa94
commit b79f395d37

View File

@ -16,6 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>. # along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from typing import List, Match, Union
import pyrogram import pyrogram
from pyrogram.api import types from pyrogram.api import types
from pyrogram.api.errors import MessageIdsEmpty from pyrogram.api.errors import MessageIdsEmpty
@ -201,18 +203,18 @@ class Message(PyrogramType):
via_bot (:obj:`User <pyrogram.User>`): via_bot (:obj:`User <pyrogram.User>`):
The information of the bot that generated the message from an inline query of a user. The information of the bot that generated the message from an inline query of a user.
outgoing (``bool``, *optional*): 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``, *optional*): matches (``List of regex Matches``, *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``, *optional*): command (``List of strings``, *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>`.
@ -226,57 +228,60 @@ class Message(PyrogramType):
def __init__(self, def __init__(self,
*, *,
client, client: "pyrogram.Client",
message_id: int, message_id: int,
date: int = None, date: int = None,
chat=None, chat: Chat = None,
from_user=None, from_user: User = None,
forward_from=None, forward_from: User = None,
forward_from_chat=None, forward_from_chat: Chat = None,
forward_from_message_id: int = None, forward_from_message_id: int = None,
forward_signature: str = None, forward_signature: str = None,
forward_date: int = None, forward_date: int = None,
reply_to_message=None, reply_to_message: "Message" = None,
mentioned=None, mentioned: bool = None,
empty=None, empty: bool = None,
service=None, service: bool = None,
media=None, media: bool = None,
edit_date: int = None, edit_date: int = None,
media_group_id: str = None, media_group_id: str = None,
author_signature: str = None, author_signature: str = None,
text: str = None, text: str = None,
entities: list = None, entities: List["pyrogram.MessageEntity"] = None,
caption_entities: list = None, caption_entities: List["pyrogram.MessageEntity"] = None,
audio=None, audio: "pyrogram.Audio" = None,
document=None, document: "pyrogram.Document" = None,
photo=None, photo: "pyrogram.Photo" = None,
sticker=None, sticker: "pyrogram.Sticker" = None,
animation=None, animation: "pyrogram.Animation" = None,
video=None, video: "pyrogram.Video" = None,
voice=None, voice: "pyrogram.Voice" = None,
video_note=None, video_note: "pyrogram.VideoNote" = None,
caption: str = None, caption: str = None,
contact=None, contact: "pyrogram.Contact" = None,
location=None, location: "pyrogram.Location" = None,
venue=None, venue: "pyrogram.Venue" = None,
web_page=None, web_page: bool = None,
new_chat_members: list = None, new_chat_members: List[User] = None,
left_chat_member=None, left_chat_member: User = None,
new_chat_title: str = None, new_chat_title: str = None,
new_chat_photo=None, new_chat_photo: "pyrogram.Photo" = None,
delete_chat_photo: bool = None, delete_chat_photo: bool = None,
group_chat_created: bool = None, group_chat_created: bool = None,
supergroup_chat_created: bool = None, supergroup_chat_created: bool = None,
channel_chat_created: bool = None, channel_chat_created: bool = None,
migrate_to_chat_id: int = None, migrate_to_chat_id: int = None,
migrate_from_chat_id: int = None, migrate_from_chat_id: int = None,
pinned_message=None, pinned_message: "Message" = None,
views: int = None, views: int = None,
via_bot=None, via_bot: User = None,
outgoing: bool = None, outgoing: bool = None,
matches: list = None, matches: List[Match] = None,
command: list = None, command: List[str] = None,
reply_markup=None): reply_markup: Union["pyrogram.InlineKeyboardMarkup",
"pyrogram.ReplyKeyboardMarkup",
"pyrogram.ReplyKeyboardRemove",
"pyrogram.ForceReply"] = None):
super().__init__(client) super().__init__(client)
self.message_id = message_id self.message_id = message_id