error handling in joke response
This commit is contained in:
@@ -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:]}'
|
||||||
)
|
)
|
||||||
|
try:
|
||||||
await joke.respond(message, self, joke_match)
|
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:
|
||||||
|
|||||||
Reference in New Issue
Block a user