Add Pterodactyl cog #19

Merged
cswimr merged 139 commits from pterodactyl into main 2024-03-02 00:07:42 -05:00
Showing only changes of commit 0aa17e8807 - Show all commits

View file

@ -1,3 +1,4 @@
import asyncio
import json import json
import logging import logging
import re import re
@ -160,7 +161,17 @@ class Pterodactyl(commands.Cog):
return tellraw return tellraw
def get_task(self): def get_task(self):
return self.bot.loop.create_task(self.establish_websocket_connection(), name="Pterodactyl Websocket Connection") task = self.bot.loop.create_task(self.establish_websocket_connection(), name="Pterodactyl Websocket Connection")
task.add_done_callback(self.error_callback)
return task
def error_callback(self, fut): #NOTE - Thanks flame442 and zephyrkul for helping me figure this out
try:
fut.result()
except asyncio.CancelledError:
pass
except Exception as e:
self.logger.error("WebSocket task has failed: %s", e, exc_info=e)
async def cog_load(self): async def cog_load(self):
self.task = self.get_task() self.task = self.get_task()