randydev commited on
Commit
9fba954
1 Parent(s): a9422f7

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +10 -7
main.py CHANGED
@@ -253,13 +253,16 @@ async def chatbot_talk(client: Client, message: Message):
253
 
254
  # Define the main coroutine
255
  async def main():
256
- await db.connect() # Connect to your database
257
- LOGS.info("Connected to the database.")
258
- await client.start() # Start the Pyrogram client
259
- LOGS.info("Bot started successfully.")
260
- await idle() # Keep the bot running until interrupted
261
- LOGS.info("Bot stopping...")
262
- await client.stop() # Ensure the client stops gracefully
 
 
 
263
 
264
  # Entry point
265
  if __name__ == "__main__":
 
253
 
254
  # Define the main coroutine
255
  async def main():
256
+ try:
257
+ await db.connect() # Connect to your database
258
+ LOGS.info("Connected to the database.")
259
+ await client.start() # Start the Pyrogram client
260
+ LOGS.info("Bot started successfully.")
261
+ await idle() # Keep the bot running until interrupted
262
+ LOGS.info("Bot stopping...")
263
+ await client.stop() # Ensure the client stops gracefully
264
+ except Exception as e:
265
+ LOGS.error(f"Unexpected error: {e}")
266
 
267
  # Entry point
268
  if __name__ == "__main__":