Avoid using telethon.sync in the examples

This commit is contained in:
Lonami Exo
2019-08-13 23:33:39 +02:00
parent 61c0e63bbe
commit e1905d0d7a
28 changed files with 283 additions and 217 deletions

View File

@@ -14,15 +14,16 @@ Each mixin has its own methods, which you all can use.
.. code-block:: python
import asyncio
from telethon import TelegramClient
client = TelegramClient(name, api_id, api_hash)
async def main():
client = await TelegramClient(name, api_id, api_hash).start()
# Now you can use all client methods listed below, like for example...
await client.send_message('me', 'Hello to myself!')
asyncio.get_event_loop().run_until_complete(main())
with client:
client.loop.run_until_complete(main())
You **don't** need to import these `AuthMethods`, `MessageMethods`, etc.