Handle errors gracefully when pinging previously joined players

This commit is contained in:
nyuszika7h 2015-04-15 23:09:39 +02:00
parent 1de23dafb8
commit 4ab966fc06

View File

@ -209,6 +209,7 @@ def connect_callback(cli):
for nick in to_be_devoiced: for nick in to_be_devoiced:
cmodes.append(("-v", nick)) cmodes.append(("-v", nick))
try:
# If the bot was restarted in the middle of the join phase, ping players that were joined. # If the bot was restarted in the middle of the join phase, ping players that were joined.
with sqlite3.connect("data.sqlite3", check_same_thread=False) as conn: with sqlite3.connect("data.sqlite3", check_same_thread=False) as conn:
c = conn.cursor() c = conn.cursor()
@ -217,6 +218,8 @@ def connect_callback(cli):
if players: if players:
cli.msg(botconfig.CHANNEL, "PING! {0}".format(players)) cli.msg(botconfig.CHANNEL, "PING! {0}".format(players))
c.execute("UPDATE pre_restart_state SET players = NULL") c.execute("UPDATE pre_restart_state SET players = NULL")
except Exception:
notify_error(cli, botconfig.CHANNEL, errlog)
# Unhook the WHO hooks # Unhook the WHO hooks
decorators.unhook(HOOKS, 295) decorators.unhook(HOOKS, 295)