randydev commited on
Commit
fa69063
·
verified ·
1 Parent(s): c7eac1c

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -6
main.py CHANGED
@@ -245,22 +245,22 @@ async def chatbot_talk(client: Client, message: Message):
245
  # End of handler
246
 
247
  # Define the main coroutine
248
- async def main():
249
  try:
250
- await db.connect() # Connect to your database
251
  LOGS.info("Connected to the database.")
252
- await client.start() # Start the Pyrogram client
253
  LOGS.info("Bot started successfully.")
254
- await idle() # Keep the bot running until interrupted
255
  LOGS.info("Bot stopping...")
256
- await client.stop() # Ensure the client stops gracefully
257
  except Exception as e:
258
  LOGS.error(f"Unexpected error: {e}")
259
 
260
  # Entry point
261
  if __name__ == "__main__":
262
  try:
263
- asyncio.run(main())
264
  except (KeyboardInterrupt, SystemExit):
265
  LOGS.info("Bot has been terminated by the user.")
266
  except Exception as e:
 
245
  # End of handler
246
 
247
  # Define the main coroutine
248
+ async def test_main():
249
  try:
250
+ await db.connect()
251
  LOGS.info("Connected to the database.")
252
+ await client.start()
253
  LOGS.info("Bot started successfully.")
254
+ await idle()
255
  LOGS.info("Bot stopping...")
256
+ await client.stop()
257
  except Exception as e:
258
  LOGS.error(f"Unexpected error: {e}")
259
 
260
  # Entry point
261
  if __name__ == "__main__":
262
  try:
263
+ asyncio.run(test_main())
264
  except (KeyboardInterrupt, SystemExit):
265
  LOGS.info("Bot has been terminated by the user.")
266
  except Exception as e: