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 e12ded9d42 - Show all commits

View file

@ -115,8 +115,9 @@ class Pterodactyl(commands.Cog):
regex = await self.config.chat_regex()
match: Optional[re.Match[str]] = re.match(regex, text)
if match:
self.logger.debug("Message is a chat message")
return {"time": match.group(1), "username": match.group(2), "message": match.group(3)}
dict = {"time": match.group(1), "username": match.group(2), "message": match.group(3)}
self.logger.debug("Message is a chat message\n%s", json.dumps(dict))
return dict
self.logger.debug("Message is not a chat message")
return False
@ -126,7 +127,7 @@ class Pterodactyl(commands.Cog):
async with aiohttp.ClientSession() as session:
async with session.get(f"https://playerdb.co/api/player/{endpoint}/{username}") as response:
if response.status == 200:
self.logger.debug("Player info retrieved for %s", username)
self.logger.debug("Player info retrieved for %s\n%s", username, json.dumps(await response.json()))
return await response.json()
else:
self.logger.error("Failed to retrieve player info for %s: %s", username, response.status)