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

View file

@ -89,7 +89,7 @@ class Pterodactyl(commands.Cog):
if content.startswith('['):
await channel.send(content=content)
#TODO - Add pagification for long messages to prevent Discord API errors
chat_message = self.check_if_chat_message(content)
chat_message = await self.check_if_chat_message(content)
if chat_message:
info = await self.get_info(chat_message['username'])
if info is not None:
@ -110,9 +110,9 @@ class Pterodactyl(commands.Cog):
#NOTE - https://chat.openai.com/share/d92f9acf-d776-4fd6-a53f-b14ac15dd540
return ansi_escape.sub('', text)
def check_if_chat_message(self, text: str) -> Union[bool, dict]:
async def check_if_chat_message(self, text: str) -> Union[bool, dict]:
self.logger.debug("Checking if message is a chat message")
regex = self.config.chat_regex()
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")