Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,9 @@ from sqlalchemy import or_, func
|
|
14 |
from FastTelethonhelper import fast_download
|
15 |
from FastTelethonhelper import fast_upload
|
16 |
from telethon import TelegramClient, events,sync
|
|
|
|
|
|
|
17 |
|
18 |
app_id = os.getenv("APP_ID")
|
19 |
api_hash = os.getenv("API_HASH")
|
@@ -26,18 +29,21 @@ api_hash = str(api_hash)
|
|
26 |
bot_token = str(btoken)
|
27 |
channel= int(chnl)
|
28 |
|
29 |
-
|
30 |
-
await client.start(bot_token=bot_token)
|
31 |
|
32 |
###DB BACKUP##
|
33 |
|
34 |
-
def downdb(msgid):
|
|
|
|
|
35 |
os.remove('instance/database.db')
|
36 |
await fast_download(client,msgid)
|
37 |
return '2'
|
38 |
|
39 |
|
40 |
-
def updb():
|
|
|
|
|
41 |
path = 'instance/database.db'
|
42 |
fle = await fast_upload(client, file_location=path)
|
43 |
await client.send_file(channel,fle, force_document=True)
|
|
|
14 |
from FastTelethonhelper import fast_download
|
15 |
from FastTelethonhelper import fast_upload
|
16 |
from telethon import TelegramClient, events,sync
|
17 |
+
import asyncio
|
18 |
+
|
19 |
+
|
20 |
|
21 |
app_id = os.getenv("APP_ID")
|
22 |
api_hash = os.getenv("API_HASH")
|
|
|
29 |
bot_token = str(btoken)
|
30 |
channel= int(chnl)
|
31 |
|
32 |
+
|
|
|
33 |
|
34 |
###DB BACKUP##
|
35 |
|
36 |
+
async def downdb(msgid):
|
37 |
+
client = TelegramClient(None, api_id, api_hash)
|
38 |
+
await client.start(bot_token=bot_token)
|
39 |
os.remove('instance/database.db')
|
40 |
await fast_download(client,msgid)
|
41 |
return '2'
|
42 |
|
43 |
|
44 |
+
async async def updb():
|
45 |
+
client = TelegramClient(None, api_id, api_hash)
|
46 |
+
await client.start(bot_token=bot_token)
|
47 |
path = 'instance/database.db'
|
48 |
fle = await fast_upload(client, file_location=path)
|
49 |
await client.send_file(channel,fle, force_document=True)
|