2019-05-09 13:24:37 +03:00
|
|
|
========================
|
|
|
|
Telethon's Documentation
|
|
|
|
========================
|
2017-11-19 19:56:05 +03:00
|
|
|
|
2019-05-09 13:24:37 +03:00
|
|
|
.. code-block:: python
|
2017-11-19 19:56:05 +03:00
|
|
|
|
2019-05-09 13:24:37 +03:00
|
|
|
from telethon.sync import TelegramClient, events
|
2017-11-19 19:56:05 +03:00
|
|
|
|
2019-05-09 13:24:37 +03:00
|
|
|
with TelegramClient('name', api_id, api_hash) as client:
|
|
|
|
client.send_message('me', 'Hello, myself!')
|
|
|
|
print(client.download_profile_photo('me'))
|
2018-01-20 13:47:17 +03:00
|
|
|
|
2019-05-09 13:24:37 +03:00
|
|
|
@client.on(events.NewMessage(pattern='(?i).*Hello'))
|
|
|
|
async def handler(event):
|
|
|
|
await event.reply('Hey!')
|
2017-11-19 19:56:05 +03:00
|
|
|
|
2019-05-09 13:24:37 +03:00
|
|
|
client.run_until_disconnected()
|
|
|
|
|
|
|
|
|
|
|
|
* Are you new here? Jump straight into :ref:`installation`!
|
|
|
|
* Looking for the method reference? See :ref:`client-ref`.
|
|
|
|
* Did you upgrade the library? Please read :ref:`changelog`.
|
|
|
|
* Used Telethon before v1.0? See :ref:`compatibility-and-convenience`.
|
2019-05-19 13:40:52 +03:00
|
|
|
* Coming from Bot API or want to create new bots? See :ref:`botapi`.
|
2019-05-22 12:29:46 +03:00
|
|
|
* Need the full API reference? https://tl.telethon.dev/.
|
2018-06-21 22:54:54 +03:00
|
|
|
|
|
|
|
|
2018-01-09 20:04:51 +03:00
|
|
|
What is this?
|
2019-05-09 13:24:37 +03:00
|
|
|
-------------
|
2018-01-09 20:04:51 +03:00
|
|
|
|
|
|
|
Telegram is a popular messaging application. This library is meant
|
|
|
|
to make it easy for you to write Python programs that can interact
|
|
|
|
with Telegram. Think of it as a wrapper that has already done the
|
|
|
|
heavy job for you, so you can focus on developing an application.
|
|
|
|
|
|
|
|
|
2019-05-09 13:24:37 +03:00
|
|
|
How should I use the documentation?
|
|
|
|
-----------------------------------
|
2017-11-20 07:12:31 +03:00
|
|
|
|
2019-05-09 13:24:37 +03:00
|
|
|
If you are getting started with the library, you should follow the
|
|
|
|
documentation in order by pressing the "Next" button at the bottom-right
|
|
|
|
of every page.
|
2017-11-19 19:56:05 +03:00
|
|
|
|
2019-05-09 13:24:37 +03:00
|
|
|
You can also use the menu on the left to quickly skip over sections.
|
2017-11-19 19:56:05 +03:00
|
|
|
|
|
|
|
.. toctree::
|
2019-05-09 13:24:37 +03:00
|
|
|
:hidden:
|
|
|
|
:caption: First Steps
|
2017-11-19 19:56:05 +03:00
|
|
|
|
2019-05-09 13:24:37 +03:00
|
|
|
basic/installation
|
|
|
|
basic/signing-in
|
|
|
|
basic/quick-start
|
|
|
|
basic/updates
|
|
|
|
basic/next-steps
|
2018-01-05 02:59:53 +03:00
|
|
|
|
|
|
|
.. toctree::
|
2019-05-09 13:24:37 +03:00
|
|
|
:hidden:
|
|
|
|
:caption: Quick References
|
2017-11-20 07:12:31 +03:00
|
|
|
|
2019-05-09 13:24:37 +03:00
|
|
|
quick-references/faq
|
|
|
|
quick-references/client-reference
|
|
|
|
quick-references/events-reference
|
|
|
|
quick-references/objects-reference
|
2017-11-19 19:56:05 +03:00
|
|
|
|
|
|
|
.. toctree::
|
2019-05-09 13:24:37 +03:00
|
|
|
:hidden:
|
|
|
|
:caption: Concepts
|
2017-11-20 07:12:31 +03:00
|
|
|
|
2019-05-09 13:24:37 +03:00
|
|
|
concepts/strings
|
|
|
|
concepts/entities
|
|
|
|
concepts/updates
|
|
|
|
concepts/sessions
|
|
|
|
concepts/full-api
|
|
|
|
concepts/errors
|
2019-05-19 13:40:52 +03:00
|
|
|
concepts/botapi-vs-mtproto
|
2019-05-09 13:24:37 +03:00
|
|
|
concepts/asyncio
|
2018-01-05 02:59:53 +03:00
|
|
|
|
|
|
|
.. toctree::
|
2019-05-09 13:24:37 +03:00
|
|
|
:hidden:
|
|
|
|
:caption: Full API Examples
|
2018-01-05 02:59:53 +03:00
|
|
|
|
2019-05-09 13:24:37 +03:00
|
|
|
examples/word-of-warning
|
|
|
|
examples/chats-and-channels
|
|
|
|
examples/users
|
|
|
|
examples/working-with-messages
|
2018-01-05 02:59:53 +03:00
|
|
|
|
|
|
|
.. toctree::
|
2019-05-09 13:24:37 +03:00
|
|
|
:hidden:
|
|
|
|
:caption: Developing
|
2018-01-05 02:59:53 +03:00
|
|
|
|
2019-05-09 13:24:37 +03:00
|
|
|
developing/philosophy.rst
|
|
|
|
developing/test-servers.rst
|
|
|
|
developing/project-structure.rst
|
|
|
|
developing/coding-style.rst
|
2019-12-08 01:41:02 +03:00
|
|
|
developing/testing.rst
|
2019-05-09 13:24:37 +03:00
|
|
|
developing/understanding-the-type-language.rst
|
|
|
|
developing/tips-for-porting-the-project.rst
|
|
|
|
developing/telegram-api-in-other-languages.rst
|
2017-11-20 07:12:31 +03:00
|
|
|
|
|
|
|
.. toctree::
|
2019-05-09 13:24:37 +03:00
|
|
|
:hidden:
|
|
|
|
:caption: Miscellaneous
|
2017-11-19 19:56:05 +03:00
|
|
|
|
2019-05-09 13:24:37 +03:00
|
|
|
misc/changelog
|
|
|
|
misc/wall-of-shame.rst
|
|
|
|
misc/compatibility-and-convenience
|
2017-11-19 19:56:05 +03:00
|
|
|
|
2019-05-09 13:24:37 +03:00
|
|
|
.. toctree::
|
|
|
|
:hidden:
|
|
|
|
:caption: Telethon Modules
|
|
|
|
|
|
|
|
modules/client
|
|
|
|
modules/events
|
|
|
|
modules/custom
|
|
|
|
modules/utils
|
|
|
|
modules/errors
|
|
|
|
modules/sessions
|
|
|
|
modules/network
|
2019-05-09 15:13:43 +03:00
|
|
|
modules/helpers
|