Spaces:
sahanind
/
No application file

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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -36,13 +36,15 @@ channel= int(chnl)
36
  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
  @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
 
48
 
@@ -509,7 +511,7 @@ def downdbur():
509
  # Create a new event loop for the current thread
510
  loop = asyncio.new_event_loop()
511
  asyncio.set_event_loop(loop)
512
-
513
  # Run the async function
514
  rp = loop.run_until_complete(downdb())
515
  loop.close() # Close the loop when done
 
36
  async def downdb():
37
  client = TelegramClient(None, api_id, api_hash)
38
  await client.start(bot_token=bot_token)
39
+
40
  os.remove('instance/database.db')
41
  @client.on(events.NewMessage)
42
  async def handler(event):
43
  last_message = event.message
44
  await fast_download(client,last_message)
45
  await client.disconnect()
46
+ db = SQLAlchemy(app)
47
+ migrate = Migrate(app, db)
48
  return '2'
49
 
50
 
 
511
  # Create a new event loop for the current thread
512
  loop = asyncio.new_event_loop()
513
  asyncio.set_event_loop(loop)
514
+ db.session.remove()
515
  # Run the async function
516
  rp = loop.run_until_complete(downdb())
517
  loop.close() # Close the loop when done