mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-25 00:34:19 +03:00
An user -> a user
This commit is contained in:
parent
d5d3733fd4
commit
ec0aa65fe1
|
@ -23,7 +23,7 @@ talk to the Telegram servers, such as to which IP the client should connect,
|
|||
port, authorization key so that messages can be encrypted, and so on.
|
||||
|
||||
These files will by default also save all the input entities that you've seen,
|
||||
so that you can get information about an user or channel by just their ID.
|
||||
so that you can get information about a user or channel by just their ID.
|
||||
Telegram will **not** send their ``access_hash`` required to retrieve more
|
||||
information about them, if it thinks you have already seem them. For this
|
||||
reason, the library needs to store this information offline.
|
||||
|
|
|
@ -47,14 +47,14 @@ how the library refers to either of these:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
# The method will infer that you've passed an username
|
||||
# The method will infer that you've passed a username
|
||||
# It also accepts phone numbers, and will get the user
|
||||
# from your contact list.
|
||||
lonami = client.get_entity('lonami')
|
||||
|
||||
The so called "entities" are another important whole concept on its own,
|
||||
but for now you don't need to worry about it. Simply know that they are
|
||||
a good way to get information about an user, chat or channel.
|
||||
a good way to get information about a user, chat or channel.
|
||||
|
||||
Many other common methods for quick scripts are also available:
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ Restricting Users
|
|||
*****************
|
||||
|
||||
Similar to how you give or revoke admin permissions, you can edit the
|
||||
banned rights of an user through :tl:`EditBannedRequest` and its parameter
|
||||
banned rights of a user through :tl:`EditBannedRequest` and its parameter
|
||||
:tl:`ChannelBannedRights`:
|
||||
|
||||
.. code-block:: python
|
||||
|
@ -232,7 +232,7 @@ banned rights of an user through :tl:`EditBannedRequest` and its parameter
|
|||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
# Restricting an user for 7 days, only allowing view/send messages.
|
||||
# Restricting a user for 7 days, only allowing view/send messages.
|
||||
#
|
||||
# Note that it's "reversed". You must set to ``True`` the permissions
|
||||
# you want to REMOVE, and leave as ``None`` those you want to KEEP.
|
||||
|
@ -272,7 +272,7 @@ https://core.telegram.org/bots/api#restrictchatmember.
|
|||
Kicking a member
|
||||
****************
|
||||
|
||||
Telegram doesn't actually have a request to kick an user from a group.
|
||||
Telegram doesn't actually have a request to kick a user from a group.
|
||||
Instead, you need to restrict them so they can't see messages. Any date
|
||||
is enough:
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ Users
|
|||
Retrieving full information
|
||||
***************************
|
||||
|
||||
If you need to retrieve the bio, biography or about information for an user
|
||||
If you need to retrieve the bio, biography or about information for a user
|
||||
you should use :tl:`GetFullUser`:
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ when you upgrade!
|
|||
.. note::
|
||||
The library uses `asyncio <https://docs.python.org/3/library/asyncio.html>`_
|
||||
under the hood, but you don't need to know anything about it unless you're
|
||||
going to work with updates! If you're an user of Telethon pre-1.0 and you
|
||||
going to work with updates! If you're a user of Telethon pre-1.0 and you
|
||||
aren't ready to convert your event handlers into ``async``, you can use
|
||||
`a simpler version <https://github.com/LonamiWebs/Telethon/tree/sync>`_
|
||||
(select the "sync" version in ``readthedocs``' bottom left corner).
|
||||
|
|
|
@ -139,7 +139,7 @@ class UserMethods(TelegramBaseClient):
|
|||
and they will be efficiently fetched from the network.
|
||||
|
||||
entity (`str` | `int` | :tl:`Peer` | :tl:`InputPeer`):
|
||||
If an username is given, **the username will be resolved** making
|
||||
If a username is given, **the username will be resolved** making
|
||||
an API call every time. Resolving usernames is an expensive
|
||||
operation and will start hitting flood waits around 50 usernames
|
||||
in a short period of time.
|
||||
|
@ -244,9 +244,9 @@ class UserMethods(TelegramBaseClient):
|
|||
>>> chat = rc(client.get_input_entity(-123456789))
|
||||
|
||||
entity (`str` | `int` | :tl:`Peer` | :tl:`InputPeer`):
|
||||
If an username or invite link is given, **the library will
|
||||
If a username or invite link is given, **the library will
|
||||
use the cache**. This means that it's possible to be using
|
||||
an username that *changed* or an old invite link (this only
|
||||
a username that *changed* or an old invite link (this only
|
||||
happens if an invite link for a small group chat is used
|
||||
after it was upgraded to a mega-group).
|
||||
|
||||
|
@ -267,7 +267,7 @@ class UserMethods(TelegramBaseClient):
|
|||
(prefixed with ``-100``).
|
||||
|
||||
If a :tl:`Peer` is given, it will be searched exactly in the
|
||||
cache as either an user, chat or channel.
|
||||
cache as either a user, chat or channel.
|
||||
|
||||
If the given object can be turned into an input entity directly,
|
||||
said operation will be done.
|
||||
|
@ -343,7 +343,7 @@ class UserMethods(TelegramBaseClient):
|
|||
async def _get_entity_from_string(self, string):
|
||||
"""
|
||||
Gets a full entity from the given string, which may be a phone or
|
||||
an username, and processes all the found entities on the session.
|
||||
a username, and processes all the found entities on the session.
|
||||
The string may also be a user link, or a channel/chat invite link.
|
||||
|
||||
This method has the side effect of adding the found users to the
|
||||
|
|
|
@ -37,7 +37,7 @@ class ChatAction(EventBuilder):
|
|||
added_by=True,
|
||||
users=msg.from_id)
|
||||
elif isinstance(action, types.MessageActionChatAddUser):
|
||||
# If an user adds itself, it means they joined
|
||||
# If a user adds itself, it means they joined
|
||||
added_by = ([msg.from_id] == action.users) or msg.from_id
|
||||
event = cls.Event(msg,
|
||||
added_by=added_by,
|
||||
|
|
|
@ -191,7 +191,7 @@ class NewMessage(EventBuilder):
|
|||
self.__dict__['_init'] = False
|
||||
if not message.out and isinstance(message.to_id, types.PeerUser):
|
||||
# Incoming message (e.g. from a bot) has to_id=us, and
|
||||
# from_id=bot (the actual "chat" from an user's perspective).
|
||||
# from_id=bot (the actual "chat" from a user's perspective).
|
||||
chat_peer = types.PeerUser(message.from_id)
|
||||
else:
|
||||
chat_peer = message.to_id
|
||||
|
|
|
@ -7,7 +7,7 @@ from ..tl import types
|
|||
@name_inner_event
|
||||
class UserUpdate(EventBuilder):
|
||||
"""
|
||||
Represents an user update (gone online, offline, joined Telegram).
|
||||
Represents a user update (gone online, offline, joined Telegram).
|
||||
"""
|
||||
@classmethod
|
||||
def build(cls, update):
|
||||
|
@ -22,7 +22,7 @@ class UserUpdate(EventBuilder):
|
|||
|
||||
class Event(EventCommon):
|
||||
"""
|
||||
Represents the event of an user status update (last seen, joined).
|
||||
Represents the event of a user status update (last seen, joined).
|
||||
|
||||
Members:
|
||||
online (`bool`, optional):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""
|
||||
Utilities for working with the Telegram API itself (such as handy methods
|
||||
to convert between an entity like an User, Chat, etc. into its Input version)
|
||||
to convert between an entity like a User, Chat, etc. into its Input version)
|
||||
"""
|
||||
import base64
|
||||
import binascii
|
||||
|
|
|
@ -51,7 +51,7 @@ USERNAME_NOT_OCCUPIED=The username is not in use by anyone else yet
|
|||
USERNAME_OCCUPIED=The username is already taken
|
||||
USERS_TOO_FEW=Not enough users (to create a chat, for example)
|
||||
USERS_TOO_MUCH=The maximum number of users has been exceeded (to create a chat, for example)
|
||||
USER_ID_INVALID=Invalid object ID for an user. Make sure to pass the right types, for instance making sure that the request is designed for users or otherwise look for a different one more suited
|
||||
USER_ID_INVALID=Invalid object ID for a user. Make sure to pass the right types, for instance making sure that the request is designed for users or otherwise look for a different one more suited
|
||||
ACTIVE_USER_REQUIRED=The method is only available to already activated users
|
||||
AUTH_KEY_INVALID=The key is invalid
|
||||
AUTH_KEY_PERM_EMPTY=The method is unavailable for temporary authorization key, not bound to permanent
|
||||
|
|
Loading…
Reference in New Issue
Block a user