Update bot.py
Browse files
bot.py
CHANGED
|
@@ -199,15 +199,11 @@ if __name__ == "__main__":
|
|
| 199 |
# Apply nest_asyncio to support nested event loops if required.
|
| 200 |
nest_asyncio.apply()
|
| 201 |
try:
|
| 202 |
-
loop = asyncio.get_event_loop()
|
| 203 |
print("in try")
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
else:
|
| 209 |
-
print("in else")
|
| 210 |
-
loop.run_until_complete(main())
|
| 211 |
except Exception as e:
|
| 212 |
logger.error(f"Error in main loop: {e}")
|
| 213 |
print(f"Error in main loop: {e}")
|
|
|
|
| 199 |
# Apply nest_asyncio to support nested event loops if required.
|
| 200 |
nest_asyncio.apply()
|
| 201 |
try:
|
|
|
|
| 202 |
print("in try")
|
| 203 |
+
loop = asyncio.get_event_loop()
|
| 204 |
+
# Schedule the main() task
|
| 205 |
+
loop.create_task(main())
|
| 206 |
+
loop.run_until_complete(main())
|
|
|
|
|
|
|
|
|
|
| 207 |
except Exception as e:
|
| 208 |
logger.error(f"Error in main loop: {e}")
|
| 209 |
print(f"Error in main loop: {e}")
|