forked from cswimr/SeaCogs
fix(pterodactyl): fixed chat messages breaking and removed debug logging
This commit is contained in:
parent
97213a5025
commit
d5600e8cf7
1 changed files with 4 additions and 16 deletions
|
@ -88,9 +88,9 @@ class Pterodactyl(commands.Cog):
|
||||||
channel = self.bot.get_channel(await self.config.console_channel())
|
channel = self.bot.get_channel(await self.config.console_channel())
|
||||||
if channel is not None:
|
if channel is not None:
|
||||||
if content.startswith('['):
|
if content.startswith('['):
|
||||||
content = pagify(content, delims=[" ", "\n"])
|
pagified_content = pagify(content, delims=[" ", "\n"])
|
||||||
for page in content:
|
for page in pagified_content:
|
||||||
await channel.send(content=page)
|
await channel.send(pagified_content=page)
|
||||||
|
|
||||||
chat_message = await self.check_if_chat_message(content)
|
chat_message = await self.check_if_chat_message(content)
|
||||||
if chat_message:
|
if chat_message:
|
||||||
|
@ -119,24 +119,12 @@ class Pterodactyl(commands.Cog):
|
||||||
async 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 = await self.config.chat_regex()
|
regex = await self.config.chat_regex()
|
||||||
self.logger.debug(regex)
|
match: Optional[re.Match[str]] = re.match(regex, text)
|
||||||
self.logger.debug('1')
|
|
||||||
try:
|
|
||||||
match: Optional[re.Match[str]] = re.match(regex, text)
|
|
||||||
except Exception:
|
|
||||||
self.logger.exception("1.5")
|
|
||||||
raise
|
|
||||||
self.logger.debug('2')
|
|
||||||
if match:
|
if match:
|
||||||
self.logger.debug('3')
|
|
||||||
dict = {"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('4')
|
|
||||||
self.logger.debug("Message is a chat message\n%s", json.dumps(dict))
|
self.logger.debug("Message is a chat message\n%s", json.dumps(dict))
|
||||||
self.logger.debug('5')
|
|
||||||
return dict
|
return dict
|
||||||
self.logger.debug('6')
|
|
||||||
self.logger.debug("Message is not a chat message")
|
self.logger.debug("Message is not a chat message")
|
||||||
self.logger.debug('7')
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
async def get_info(self, username: str) -> Optional[dict]:
|
async def get_info(self, username: str) -> Optional[dict]:
|
||||||
|
|
Loading…
Reference in a new issue