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 committed by Jeremy Stanley
parent 4c31332e23
commit 52bf62acc6
1 changed files with 9 additions and 5 deletions

View File

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