mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2026-09-08 01:41:59 +00:00
Multiple small changes/fixed typos to docs/error messages (#623)
This commit is contained in:
@@ -455,7 +455,9 @@ class TelegramBareClient:
|
||||
with self._reconnect_lock:
|
||||
self._reconnect()
|
||||
|
||||
raise RuntimeError('Number of retries reached 0.')
|
||||
raise RuntimeError('Number of retries reached 0 for {}.'.format(
|
||||
[type(x).__name__ for x in requests]
|
||||
))
|
||||
|
||||
# Let people use client.invoke(SomeRequest()) instead client(...)
|
||||
invoke = __call__
|
||||
|
||||
@@ -586,7 +586,7 @@ class TelegramClient(TelegramBareClient):
|
||||
|
||||
Returns:
|
||||
A list of custom ``Draft`` objects that are easy to work with:
|
||||
You can call :meth:`draft.set_message('text')` to change the message,
|
||||
You can call ``draft.set_message('text')`` to change the message,
|
||||
or delete it through :meth:`draft.delete()`.
|
||||
"""
|
||||
response = self(GetAllDraftsRequest())
|
||||
@@ -2193,7 +2193,7 @@ class TelegramClient(TelegramBareClient):
|
||||
return utils.get_input_peer(entity)
|
||||
|
||||
raise TypeError(
|
||||
'Could not find the input entity corresponding to "{}".'
|
||||
'Could not find the input entity corresponding to "{}". '
|
||||
'Make sure you have encountered this peer before.'.format(peer)
|
||||
)
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class Draft:
|
||||
"""
|
||||
Changes the draft message on the Telegram servers. The changes are
|
||||
reflected in this object. Changing only individual attributes like for
|
||||
example the `reply_to_msg_id` should be done by providing the current
|
||||
example the ``reply_to_msg_id`` should be done by providing the current
|
||||
values of this object, like so:
|
||||
|
||||
draft.set_message(
|
||||
@@ -56,7 +56,7 @@ class Draft:
|
||||
:param bool no_webpage: Whether to attach a web page preview
|
||||
:param int reply_to_msg_id: Message id to reply to
|
||||
:param list entities: A list of formatting entities
|
||||
:return bool: `True` on success
|
||||
:return bool: ``True`` on success
|
||||
"""
|
||||
result = self._client(SaveDraftRequest(
|
||||
peer=self._peer,
|
||||
@@ -77,6 +77,6 @@ class Draft:
|
||||
def delete(self):
|
||||
"""
|
||||
Deletes this draft
|
||||
:return bool: `True` on success
|
||||
:return bool: ``True`` on success
|
||||
"""
|
||||
return self.set_message(text='')
|
||||
|
||||
+4
-2
@@ -35,8 +35,10 @@ VALID_USERNAME_RE = re.compile(r'^[a-zA-Z][\w\d]{3,30}[a-zA-Z\d]$')
|
||||
|
||||
|
||||
def get_display_name(entity):
|
||||
"""Gets the input peer for the given "entity" (user, chat or channel)
|
||||
Returns None if it was not found"""
|
||||
"""
|
||||
Gets the display name for the given entity, if it's an ``User``,
|
||||
``Chat`` or ``Channel``. Returns an empty string otherwise.
|
||||
"""
|
||||
if isinstance(entity, User):
|
||||
if entity.last_name and entity.first_name:
|
||||
return '{} {}'.format(entity.first_name, entity.last_name)
|
||||
|
||||
Reference in New Issue
Block a user