Handle exception for unprivileged commands

This change prevents the bot from crashing on unprivileged commands.

Change-Id: Ib855550aaccfdaca6b8997611de19603ecff72e2
This commit is contained in:
Tristan Cacqueray 2021-09-08 20:37:03 +00:00
parent 66c1629a41
commit ae034b69ae
1 changed files with 9 additions and 5 deletions

View File

@ -366,11 +366,15 @@ class BaseStatusBot(irc.bot.SingleServerIRCBot):
nick = e.source.split('!')[0] nick = e.source.split('!')[0]
msg = e.arguments[0] msg = e.arguments[0]
# Unprivileged commands # Unprivileged commands
if msg.startswith('#success'): try:
self.handle_success_command(e.target, nick, msg) if msg.startswith('#success'):
return self.handle_success_command(e.target, nick, msg)
if msg.startswith('#thanks'): return
self.handle_thanks_command(e.target, nick, msg) if msg.startswith('#thanks'):
self.handle_thanks_command(e.target, nick, msg)
return
except Exception:
self.log.exception("Exception handling command %s" % msg)
return return
# Privileged commands # Privileged commands
if not msg.startswith('#status'): if not msg.startswith('#status'):