Spaces:
sahanind
/
No application file

sahanind commited on
Commit
7b9bbfc
·
verified ·
1 Parent(s): e8c3ce9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -37,8 +37,11 @@ async def downdb():
37
  client = TelegramClient(None, api_id, api_hash)
38
  await client.start(bot_token=bot_token)
39
  os.remove('instance/database.db')
40
- last_message = (await client.get_messages(channel, 1))[0]
41
- await fast_download(client,last_message)
 
 
 
42
 
43
  return '2'
44
 
@@ -51,6 +54,7 @@ async def updb():
51
  entity = await client.get_entity(channel)
52
 
53
  await client.send_file(entity,fle, force_document=True)
 
54
  return '2'
55
 
56
  app = Flask("Simplz")
 
37
  client = TelegramClient(None, api_id, api_hash)
38
  await client.start(bot_token=bot_token)
39
  os.remove('instance/database.db')
40
+ @client.on(events.NewMessage)
41
+ async def handler(event):
42
+ last_message = event.message
43
+ await fast_download(client,last_message)
44
+ await client.disconnect()
45
 
46
  return '2'
47
 
 
54
  entity = await client.get_entity(channel)
55
 
56
  await client.send_file(entity,fle, force_document=True)
57
+ await client.disconnect()
58
  return '2'
59
 
60
  app = Flask("Simplz")