mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 09:26:37 +03:00
Clean-up docs and merge some imports
This commit is contained in:
parent
780c66c619
commit
ae87d452c8
|
@ -11,10 +11,10 @@ Accessing the Full API
|
|||
reason not to, like a method not existing or you wanting more control.
|
||||
|
||||
|
||||
The ``TelegramClient`` doesn't offer a method for every single request
|
||||
the Telegram API supports. However, it's very simple to *call* or *invoke*
|
||||
any request. Whenever you need something, don't forget to `check the
|
||||
documentation`__ and look for the `method you need`__. There you can go
|
||||
The `telethon.telegram_client.TelegramClient` doesn't offer a method for every
|
||||
single request the Telegram API supports. However, it's very simple to *call*
|
||||
or *invoke* any request. Whenever you need something, don't forget to `check
|
||||
the documentation`__ and look for the `method you need`__. There you can go
|
||||
through a sorted list of everything you can do.
|
||||
|
||||
|
||||
|
@ -30,9 +30,9 @@ You should also refer to the documentation to see what the objects
|
|||
(constructors) Telegram returns look like. Every constructor inherits
|
||||
from a common type, and that's the reason for this distinction.
|
||||
|
||||
Say ``client.send_message()`` didn't exist, we could use the `search`__
|
||||
to look for "message". There we would find :tl:`SendMessageRequest`,
|
||||
which we can work with.
|
||||
Say `telethon.telegram_client.TelegramClient.send_message` didn't exist,
|
||||
we could use the `search`__ to look for "message". There we would find
|
||||
:tl:`SendMessageRequest`, which we can work with.
|
||||
|
||||
Every request is a Python class, and has the parameters needed for you
|
||||
to invoke it. You can also call ``help(request)`` for information on
|
||||
|
@ -63,7 +63,7 @@ construct one, for instance:
|
|||
|
||||
peer = InputPeerUser(user_id, user_hash)
|
||||
|
||||
Or we call ``.get_input_entity()``:
|
||||
Or we call `telethon.telegram_client.TelegramClient.get_input_entity()`:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -74,7 +74,7 @@ When you're going to invoke an API method, most require you to pass an
|
|||
``.get_input_entity()`` is more straightforward (and often
|
||||
immediate, if you've seen the user before, know their ID, etc.).
|
||||
If you also need to have information about the whole user, use
|
||||
``.get_entity()`` instead:
|
||||
`telethon.telegram_client.TelegramClient.get_entity()` instead:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -83,7 +83,7 @@ If you also need to have information about the whole user, use
|
|||
In the later case, when you use the entity, the library will cast it to
|
||||
its "input" version for you. If you already have the complete user and
|
||||
want to cache its input version so the library doesn't have to do this
|
||||
every time its used, simply call ``.get_input_peer``:
|
||||
every time its used, simply call `telethon.utils.get_input_peer`:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ Session Files
|
|||
The first parameter you pass to the constructor of the ``TelegramClient`` is
|
||||
the ``session``, and defaults to be the session name (or full path). That is,
|
||||
if you create a ``TelegramClient('anon')`` instance and connect, an
|
||||
``anon.session`` file will be created on the working directory.
|
||||
``anon.session`` file will be created in the working directory.
|
||||
|
||||
Note that if you pass a string it will be a file in the current working
|
||||
directory, although you can also pass absolute paths.
|
||||
|
|
|
@ -44,7 +44,7 @@ That's it! This is the old way to listen for raw updates, with no further
|
|||
processing. If this feels annoying for you, remember that you can always
|
||||
use :ref:`working-with-updates` but maybe use this for some other cases.
|
||||
|
||||
Now let's do something more interesting. Every time an user talks to use,
|
||||
Now let's do something more interesting. Every time an user talks to us,
|
||||
let's reply to them with the same text reversed:
|
||||
|
||||
.. code-block:: python
|
||||
|
|
|
@ -58,8 +58,7 @@ Manual Installation
|
|||
|
||||
5. Done!
|
||||
|
||||
To generate the `method documentation`__, ``cd docs`` and then
|
||||
``python3 generate.py`` (if some pages render bad do it twice).
|
||||
To generate the `method documentation`__, ``python3 setup.py gen docs``.
|
||||
|
||||
|
||||
Optional dependencies
|
||||
|
|
|
@ -2,14 +2,15 @@
|
|||
Deleted, Limited or Deactivated Accounts
|
||||
========================================
|
||||
|
||||
If you're from Iran or Russian, we have bad news for you.
|
||||
Telegram is much more likely to ban these numbers,
|
||||
as they are often used to spam other accounts,
|
||||
likely through the use of libraries like this one.
|
||||
The best advice we can give you is to not abuse the API,
|
||||
like calling many requests really quickly,
|
||||
If you're from Iran or Russia, we have bad news for you. Telegram is much more
|
||||
likely to ban these numbers, as they are often used to spam other accounts,
|
||||
likely through the use of libraries like this one. The best advice we can
|
||||
give you is to not abuse the API, like calling many requests really quickly,
|
||||
and to sign up with these phones through an official application.
|
||||
|
||||
We have also had reports from Kazakhstan and China, where connecting
|
||||
would fail. To solve these connection problems, you should use a proxy.
|
||||
|
||||
Telegram may also ban virtual (VoIP) phone numbers,
|
||||
as again, they're likely to be used for spam.
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@ from ..tl.types import (
|
|||
ServerDHInnerData, ClientDHInnerData, DhGenOk, DhGenRetry, DhGenFail
|
||||
)
|
||||
from .. import helpers as utils
|
||||
from ..crypto import AES, AuthKey, Factorization
|
||||
from ..crypto import rsa
|
||||
from ..crypto import AES, AuthKey, Factorization, rsa
|
||||
from ..errors import SecurityError
|
||||
from ..extensions import BinaryReader
|
||||
from ..network import MtProtoPlainSender
|
||||
|
|
|
@ -36,10 +36,20 @@
|
|||
body {
|
||||
font-family: 'Hack', monospace;
|
||||
color: #0a0;
|
||||
background-color:#000;
|
||||
background-color: #000;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
::-moz-selection {
|
||||
color: #000;
|
||||
background: #0a0;
|
||||
}
|
||||
|
||||
::selection {
|
||||
color: #000;
|
||||
background: #0a0;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0a0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user