error handling in joke response

This commit is contained in:
John Lancaster
2023-06-09 21:42:08 -05:00
parent b2c121a7e7
commit 1affde8471

View File

@@ -47,10 +47,14 @@ class Kwaylon(Client):
if (joke_match := joke.scan(message)): if (joke_match := joke.scan(message)):
start, end = joke_match.start(), joke_match.end() start, end = joke_match.start(), joke_match.end()
_log.info( _log.info(
f'[light_slate_blue]{joke.__class__.__name__}[/]' + f'[light_slate_blue]{joke.__class__.__name__}[/] ' +
f'{message.content[:start]}[green]{message.content[start:end]}[/]{message.content[end:]}' f'{message.content[:start]}[green]{message.content[start:end]}[/]{message.content[end:]}'
) )
await joke.respond(message, self, joke_match) try:
await joke.respond(message, self, joke_match)
except Exception as e:
_log.error(f'[bold red]{type(e).__name__}[/] when responding to [cyan1]{type(joke).__name__}[/]')
raise
async def read_command(self, message: Message): async def read_command(self, message: Message):
for mention in message.mentions: for mention in message.mentions: