Spaces:
Running
Running
Update main.py
Browse files
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 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
|
|
|
|
|
|
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__":
|