mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-02 03:00:15 +03:00
Update index.rst
to avoid multiple errors and warnings
This commit is contained in:
parent
15f30ed942
commit
0409ce67ce
|
@ -4,9 +4,21 @@ Telethon's Documentation
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
import sys
|
||||
import os
|
||||
os.chdir(sys.path[0])
|
||||
|
||||
session_name = "name"
|
||||
|
||||
if f"{session_name}.session" in os.listdir():
|
||||
os.remove(f"{session_name}.session")
|
||||
|
||||
import nest_asyncio
|
||||
nest_asyncio.apply()
|
||||
|
||||
from telethon.sync import TelegramClient, events
|
||||
|
||||
with TelegramClient('name', api_id, api_hash) as client:
|
||||
async with TelegramClient(session_name, api_id, api_hash) as client:
|
||||
client.send_message('me', 'Hello, myself!')
|
||||
print(client.download_profile_photo('me'))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user