Create bdl.py
Browse files
bdl.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from FastTelethonhelper import fast_download
|
| 2 |
+
from FastTelethonhelper import fast_upload
|
| 3 |
+
from telethon import TelegramClient, events,sync
|
| 4 |
+
import asyncio
|
| 5 |
+
|
| 6 |
+
async def downdb():
|
| 7 |
+
client = TelegramClient(None, api_id, api_hash)
|
| 8 |
+
await client.start(bot_token=bot_token)
|
| 9 |
+
|
| 10 |
+
os.remove('instance/database.db')
|
| 11 |
+
@client.on(events.NewMessage)
|
| 12 |
+
async def handler(event):
|
| 13 |
+
last_message = event.message
|
| 14 |
+
await fast_download(client,last_message)
|
| 15 |
+
await asyncio.sleep(10)
|
| 16 |
+
await client.disconnect()
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
return '2'
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
loop = asyncio.new_event_loop()
|
| 23 |
+
asyncio.set_event_loop(loop)
|
| 24 |
+
|
| 25 |
+
rp = loop.run_until_complete(downdb())
|
| 26 |
+
print('done')
|