mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2026-09-08 18:01:58 +00:00
Update documentation with new sections
This commit is contained in:
@@ -28,7 +28,6 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods):
|
||||
reverse=False, _total=None):
|
||||
"""
|
||||
Iterator over the message history for the specified entity.
|
||||
|
||||
If either `search`, `filter` or `from_user` are provided,
|
||||
:tl:`messages.Search` will be used instead of :tl:`messages.getHistory`.
|
||||
|
||||
@@ -48,6 +47,7 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods):
|
||||
Number of messages to be retrieved. Due to limitations with
|
||||
the API retrieving more than 3000 messages will take longer
|
||||
than half a minute (or even more based on previous calls).
|
||||
|
||||
The limit may also be ``None``, which would eventually return
|
||||
the whole history.
|
||||
|
||||
@@ -411,8 +411,7 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods):
|
||||
Whether the existing draft should be cleared or not.
|
||||
Has no effect when sending a file.
|
||||
|
||||
buttons (`list`, `custom.Button <telethon.tl.custom.button.Button>`,
|
||||
:tl:`KeyboardButton`):
|
||||
buttons (`list`, `custom.Button <telethon.tl.custom.button.Button>`, :tl:`KeyboardButton`):
|
||||
The matrix (list of lists), row list or button to be shown
|
||||
after sending the message. This parameter will only work if
|
||||
you have signed in as a bot. You can also pass your own
|
||||
@@ -616,8 +615,7 @@ class MessageMethods(UploadMethods, ButtonMethods, MessageParseMethods):
|
||||
The file object that should replace the existing media
|
||||
in the message.
|
||||
|
||||
buttons (`list`, `custom.Button <telethon.tl.custom.button.Button>`,
|
||||
:tl:`KeyboardButton`):
|
||||
buttons (`list`, `custom.Button <telethon.tl.custom.button.Button>`, :tl:`KeyboardButton`):
|
||||
The matrix (list of lists), row list or button to be shown
|
||||
after sending the message. This parameter will only work if
|
||||
you have signed in as a bot. You can also pass your own
|
||||
|
||||
@@ -71,6 +71,10 @@ class UploadMethods(ButtonMethods, MessageParseMethods, UserMethods):
|
||||
Optional JPEG thumbnail (for documents). **Telegram will
|
||||
ignore this parameter** unless you pass a ``.jpg`` file!
|
||||
|
||||
The file must also be small in dimensions and in-disk size.
|
||||
Successful thumbnails were files below 20kb and 200x200px.
|
||||
Width/height and dimensions/size ratios may be important.
|
||||
|
||||
allow_cache (`bool`, optional):
|
||||
Whether to allow using the cached version stored in the
|
||||
database or not. Defaults to ``True`` to avoid re-uploads.
|
||||
@@ -94,8 +98,7 @@ class UploadMethods(ButtonMethods, MessageParseMethods, UserMethods):
|
||||
Set `allow_cache` to ``False`` if you sent the same file
|
||||
without this setting before for it to work.
|
||||
|
||||
buttons (`list`, `custom.Button <telethon.tl.custom.button.Button>`,
|
||||
:tl:`KeyboardButton`):
|
||||
buttons (`list`, `custom.Button <telethon.tl.custom.button.Button>`, :tl:`KeyboardButton`):
|
||||
The matrix (list of lists), row list or button to be shown
|
||||
after sending the message. This parameter will only work if
|
||||
you have signed in as a bot. You can also pass your own
|
||||
|
||||
@@ -304,7 +304,7 @@ class UserMethods(TelegramBaseClient):
|
||||
return utils.get_input_peer(peer)
|
||||
|
||||
raise ValueError(
|
||||
'Could not find the input entity for "{}". Please read https://'
|
||||
'Could not find the input entity for {!r}. Please read https://'
|
||||
'telethon.readthedocs.io/en/latest/extra/basic/entities.html to'
|
||||
' find out more details.'
|
||||
.format(peer)
|
||||
|
||||
@@ -34,8 +34,7 @@ class InlineBuilder:
|
||||
game (`bool`, optional):
|
||||
May be ``True`` to indicate that the game will be sent.
|
||||
|
||||
buttons (`list`, `custom.Button <telethon.tl.custom.button.Button>`,
|
||||
:tl:`KeyboardButton`, optional):
|
||||
buttons (`list`, `custom.Button <telethon.tl.custom.button.Button>`, :tl:`KeyboardButton`, optional):
|
||||
Same as ``buttons`` for `client.send_message
|
||||
<telethon.client.messages.MessageMethods.send_message>`.
|
||||
|
||||
|
||||
+10
-6
@@ -33,6 +33,9 @@ mimetypes.add_type('audio/ogg', '.ogg')
|
||||
USERNAME_RE = re.compile(
|
||||
r'@|(?:https?://)?(?:www\.)?(?:telegram\.(?:me|dog)|t\.me)/(joinchat/)?'
|
||||
)
|
||||
TG_JOIN_RE = re.compile(
|
||||
r'tg://(join)?invite='
|
||||
)
|
||||
|
||||
# The only shorter-than-five-characters usernames are those used for some
|
||||
# special, very well known bots. This list may be incomplete though:
|
||||
@@ -646,15 +649,16 @@ def parse_phone(phone):
|
||||
|
||||
|
||||
def parse_username(username):
|
||||
"""Parses the given username or channel access hash, given
|
||||
a string, username or URL. Returns a tuple consisting of
|
||||
both the stripped, lowercase username and whether it is
|
||||
a joinchat/ hash (in which case is not lowercase'd).
|
||||
"""
|
||||
Parses the given username or channel access hash, given
|
||||
a string, username or URL. Returns a tuple consisting of
|
||||
both the stripped, lowercase username and whether it is
|
||||
a joinchat/ hash (in which case is not lowercase'd).
|
||||
|
||||
Returns ``None`` if the ``username`` is not valid.
|
||||
Returns ``(None, False)`` if the ``username`` or link is not valid.
|
||||
"""
|
||||
username = username.strip()
|
||||
m = USERNAME_RE.match(username)
|
||||
m = USERNAME_RE.match(username) or TG_JOIN_RE.match(username)
|
||||
if m:
|
||||
username = username[m.end():]
|
||||
is_invite = bool(m.group(1))
|
||||
|
||||
Reference in New Issue
Block a user