Document custom.Message

This commit is contained in:
Lonami Exo 2018-06-02 12:52:38 +02:00
parent 5c76af34aa
commit f7222407de
6 changed files with 48 additions and 16 deletions

View File

@ -19,3 +19,21 @@ telethon\.tl\.custom\.dialog module
:members:
:undoc-members:
:show-inheritance:
telethon\.tl\.custom\.message module
------------------------------------
.. automodule:: telethon.tl.custom.message
:members:
:undoc-members:
:show-inheritance:
telethon\.tl\.custom\.messagebutton module
------------------------------------------
.. automodule:: telethon.tl.custom.messagebutton
:members:
:undoc-members:
:show-inheritance:

View File

@ -204,8 +204,8 @@ class ChatAction(EventBuilder):
@property
def pinned_message(self):
"""
If ``new_pin`` is ``True``, this returns the (:tl:`Message`)
object that was pinned.
If ``new_pin`` is ``True``, this returns the
`telethon.tl.custom.message.Message` object that was pinned.
"""
if self._pinned_message == 0:
return None

View File

@ -91,7 +91,8 @@ class MessageRead(EventBuilder):
@property
def messages(self):
"""
The list of :tl:`Message` **which contents'** were read.
The list of `telethon.tl.custom.message.Message`
**which contents'** were read.
Use :meth:`is_read` if you need to check whether a message
was read instead checking if it's in here.

View File

@ -800,7 +800,7 @@ class TelegramClient(TelegramBareClient):
Has no effect when sending a file.
Returns:
The sent :tl:`Message`.
The sent `telethon.tl.custom.message.Message`.
"""
if file is not None:
return self.send_file(
@ -880,8 +880,8 @@ class TelegramClient(TelegramBareClient):
order for the forward to work.
Returns:
The list of forwarded :tl:`Message`, or a single one if a list
wasn't provided as input.
The list of forwarded `telethon.tl.custom.message.Message`,
or a single one if a list wasn't provided as input.
"""
single = not utils.is_list_like(messages)
if single:
@ -974,7 +974,7 @@ class TelegramClient(TelegramBareClient):
not modified at all.
Returns:
The edited :tl:`Message`.
The edited `telethon.tl.custom.message.Message`.
"""
if isinstance(entity, Message):
text = message # Shift the parameters to the right
@ -1109,12 +1109,7 @@ class TelegramClient(TelegramBareClient):
A single-item list to pass the total parameter by reference.
Yields:
Instances of :tl:`Message` with extra attributes:
* ``.sender`` = entity of the sender.
* ``.fwd_from.sender`` = if fwd_from, who sent it originally.
* ``.fwd_from.channel`` = if fwd_from, original channel.
* ``.to`` = entity to which the message was sent.
Instances of `telethon.tl.custom.message.Message`.
Notes:
Telegram's flood wait limit for :tl:`GetHistoryRequest` seems to
@ -1610,8 +1605,8 @@ class TelegramClient(TelegramBareClient):
it will be used to determine metadata from audio and video files.
Returns:
The :tl:`Message` (or messages) containing the sent file,
or messages if a list of them was passed.
The `telethon.tl.custom.message.Message` (or messages) containing
the sent file, or messages if a list of them was passed.
"""
# First check if the user passed an iterable, in which case
# we may want to send as an album if all are photo files.

View File

@ -66,6 +66,10 @@ class Message:
@property
def client(self):
"""
Returns the `telethon.telegram_client.TelegramClient` instance that
created this instance.
"""
return self._client
@property
@ -176,6 +180,15 @@ class Message:
@property
def input_chat(self):
"""
This (:tl:`InputPeer`) is the input version of the chat where the
message was sent. Similarly to `input_sender`, this doesn't have
things like username or similar, but still useful in some cases.
Note that this might not be available if the library doesn't know
where the message came from, and it may fetch the dialogs to try
to find it in the worst case.
"""
if self._input_chat is None:
if self._chat is None:
try:
@ -350,7 +363,8 @@ class Message:
@property
def reply_message(self):
"""
The :tl:`Message` that this message is replying to, or ``None``.
The `telethon.tl.custom.message.Message` that this message is replying
to, or ``None``.
Note that this will make a network call to fetch the message and
will later be cached.

View File

@ -22,6 +22,10 @@ class MessageButton:
@property
def client(self):
"""
Returns the `telethon.telegram_client.TelegramClient` instance that
created this instance.
"""
return self._client
@property