diff --git a/telethon/client/downloads.py b/telethon/client/downloads.py index cc3702c6..65ac8880 100644 --- a/telethon/client/downloads.py +++ b/telethon/client/downloads.py @@ -104,7 +104,7 @@ class DownloadMethods(UserMethods): ``cryptg`` (through ``pip install cryptg``) so that decrypting the received data is done in C instead of Python (much faster). - message (:tl:`Message` | :tl:`Media`): + message (`Message ` | :tl:`Media`): The media or message containing the media that will be downloaded. file (`str` | `file`, optional): diff --git a/telethon/client/messages.py b/telethon/client/messages.py index aa46035a..d7eac345 100644 --- a/telethon/client/messages.py +++ b/telethon/client/messages.py @@ -349,8 +349,8 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods): specified it makes sense that it should return the entirety of it. If `ids` is present in the *named* arguments and is not a list, - a single :tl:`Message` will be returned for convenience instead - of a list. + a single `Message ` will be + returned for convenience instead of a list. """ total = [0] kwargs['_total'] = total @@ -397,7 +397,7 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods): entity (`entity`): To who will it be sent. - message (`str` | :tl:`Message`): + message (`str` | `Message `): The message to be sent, or another message object to resend. The maximum length for a message is 35,000 bytes or 4,096 @@ -405,13 +405,15 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods): and you should slice them manually if the text to send is longer than said length. - reply_to (`int` | :tl:`Message`, optional): + reply_to (`int` | `Message `, optional): Whether to reply to a message or not. If an integer is provided, it should be the ID of the message that it should reply to. parse_mode (`object`, optional): - See the `TelegramClient.parse_mode` property for allowed - values. Markdown parsing will be used by default. + See the `TelegramClient.parse_mode + ` + property for allowed values. Markdown parsing will be used by + default. link_preview (`bool`, optional): Should the link preview be shown? @@ -510,10 +512,9 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods): result = await self(request) if isinstance(result, types.UpdateShortSentMessage): - to_id, cls = utils.resolve_id(utils.get_peer_id(entity)) message = types.Message( id=result.id, - to_id=cls(to_id), + to_id=utils.get_peer(entity), message=message, date=result.date, out=result.out, @@ -535,7 +536,7 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods): entity (`entity`): To which entity the message(s) will be forwarded. - messages (`list` | `int` | :tl:`Message`): + messages (`list` | `int` | `Message `): The message(s) to forward, or their integer IDs. from_peer (`entity`): @@ -617,24 +618,28 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods): Edits the given message ID (to change its contents or disable preview). Args: - entity (`entity` | :tl:`Message`): + entity (`entity` | `Message `): From which chat to edit the message. This can also be the message to be edited, and the entity will be inferred from it, so the next parameter will be assumed to be the message text. - message (`int` | :tl:`Message` | `str`): - The ID of the message (or :tl:`Message` itself) to be edited. - If the `entity` was a :tl:`Message`, then this message will be - treated as the new text. + message (`int` | `Message ` | `str`): + The ID of the message (or `Message + ` itself) to be edited. + If the `entity` was a `Message + `, then this message + will be treated as the new text. text (`str`, optional): The new text of the message. Does nothing if the `entity` - was a :tl:`Message`. + was a `Message `. parse_mode (`object`, optional): - See the `TelegramClient.parse_mode` property for allowed - values. Markdown parsing will be used by default. + See the `TelegramClient.parse_mode + ` + property for allowed values. Markdown parsing will be used by + default. link_preview (`bool`, optional): Should the link preview be shown? @@ -701,7 +706,7 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods): be ``None`` for normal chats, but **must** be present for channels and megagroups. - message_ids (`list` | `int` | :tl:`Message`): + message_ids (`list` | `int` | `Message `): The IDs (or ID) or messages to be deleted. revoke (`bool`, optional): @@ -751,7 +756,7 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods): entity (`entity`): The chat where these messages are located. - message (`list` | :tl:`Message`): + message (`list` | `Message `): Either a list of messages or a single message. max_id (`int`): diff --git a/telethon/client/uploads.py b/telethon/client/uploads.py index 9846c0cd..0cb74462 100644 --- a/telethon/client/uploads.py +++ b/telethon/client/uploads.py @@ -68,7 +68,7 @@ class UploadMethods(ButtonMethods, MessageParseMethods, UserMethods): A callback function accepting two parameters: ``(sent bytes, total)``. - reply_to (`int` | :tl:`Message`): + reply_to (`int` | `Message `): Same as `reply_to` from `send_message`. attributes (`list`, optional): @@ -90,8 +90,10 @@ class UploadMethods(ButtonMethods, MessageParseMethods, UserMethods): or thumb than those that were used when the file was cached. parse_mode (`object`, optional): - See the `TelegramClient.parse_mode` property for allowed - values. Markdown parsing will be used by default. + See the `TelegramClient.parse_mode + ` + property for allowed values. Markdown parsing will be used by + default. voice_note (`bool`, optional): If ``True`` the audio will be sent as a voice note. diff --git a/telethon/events/callbackquery.py b/telethon/events/callbackquery.py index 142a9d5a..d9329679 100644 --- a/telethon/events/callbackquery.py +++ b/telethon/events/callbackquery.py @@ -232,7 +232,7 @@ class CallbackQuery(EventBuilder): `telethon.client.messages.MessageMethods.edit_message` with both ``entity`` and ``message`` already set. - Returns the edited :tl:`Message`. + Returns the edited `Message `. This method also creates a task to `answer` the callback. diff --git a/telethon/events/newmessage.py b/telethon/events/newmessage.py index 27de8e68..01f378ef 100644 --- a/telethon/events/newmessage.py +++ b/telethon/events/newmessage.py @@ -20,11 +20,11 @@ class NewMessage(EventBuilder): Mutually exclusive with ``incoming`` (can only set one of either). from_users (`entity`, optional): - Unlike `chats`, this parameter filters the *sender* of the message. - That is, only messages *sent by this user* will be handled. Use - `chats` if you want private messages with this/these users. - `from_users` lets you filter by messages sent by one or more users - across the desired chats. + Unlike `chats`, this parameter filters the *senders* of the + message. That is, only messages *sent by these users* will be + handled. Use `chats` if you want private messages with this/these + users. `from_users` lets you filter by messages sent by *one or + more* users across the desired chats (doesn't need a list). forwards (`bool`, optional): Whether forwarded messages should be handled or not. By default, @@ -162,7 +162,7 @@ class NewMessage(EventBuilder): **refer to its documentation** to know what you can do with this event. Members: - message (:tl:`Message`): + message (`Message `): This is the only difference with the received `telethon.tl.custom.message.Message`, and will return the `telethon.tl.custom.message.Message` itself, diff --git a/telethon/tl/custom/conversation.py b/telethon/tl/custom/conversation.py index 99fff7da..9ddc9e33 100644 --- a/telethon/tl/custom/conversation.py +++ b/telethon/tl/custom/conversation.py @@ -112,7 +112,7 @@ class Conversation(ChatGetter): Returns a coroutine that will resolve once a response arrives. Args: - message (:tl:`Message` | `int`, optional): + message (`Message ` | `int`, optional): The message (or the message ID) for which a response is expected. By default this is the last sent message. diff --git a/telethon/tl/custom/dialog.py b/telethon/tl/custom/dialog.py index d71c8c3a..404dba94 100644 --- a/telethon/tl/custom/dialog.py +++ b/telethon/tl/custom/dialog.py @@ -17,7 +17,7 @@ class Dialog: pinned (`bool`): Whether this dialog is pinned to the top or not. - message (:tl:`Message`): + message (`Message `): The last message sent on this dialog. Note that this member will not be updated when new messages arrive, it's only set on creation of the instance. diff --git a/telethon/tl/custom/inlineresult.py b/telethon/tl/custom/inlineresult.py index 8c8d87a3..04e82cab 100644 --- a/telethon/tl/custom/inlineresult.py +++ b/telethon/tl/custom/inlineresult.py @@ -106,7 +106,7 @@ class InlineResult: entity (`entity`): The entity to which the message of this result should be sent. - reply_to (`int` | :tl:`Message`, optional): + reply_to (`int` | `Message `, optional): If present, the sent message will reply to this ID or message. silent (`bool`, optional): diff --git a/telethon/tl/custom/message.py b/telethon/tl/custom/message.py index 0fc25a9c..d8c2b4ca 100644 --- a/telethon/tl/custom/message.py +++ b/telethon/tl/custom/message.py @@ -65,7 +65,8 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC): messages. message (`str`): - The string text of the message for :tl:`Message` instances, + The string text of the message for `Message + ` instances, which will be ``None`` for other types of messages. action (:tl:`MessageAction`):