fix(pterodactyl): awaited a coroutine
Some checks failed
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 18s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 25s

This commit is contained in:
Seaswimmer 2024-02-29 16:53:09 -05:00
parent 7e728087c4
commit f42c536f7c
Signed by: cswimr
GPG key ID: B8953EC01E5C4063

View file

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