From 9febeb45f46f049a61de306c1e618ecabe81b345 Mon Sep 17 00:00:00 2001 From: linuxdaemon Date: Wed, 3 Jan 2018 18:30:03 -0600 Subject: [PATCH] Fix displayed score when beffing/shooting a duck --- plugins/duckhunt.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/duckhunt.py b/plugins/duckhunt.py index 556dc16d6..d19f20274 100644 --- a/plugins/duckhunt.py +++ b/plugins/duckhunt.py @@ -281,8 +281,10 @@ def update_score(nick, chan, db, conn, shoot=0, friend=0): .where(table.c.name == nick.lower())).fetchone() if score: dbupdate(nick, chan, db, conn, score[0] + shoot, score[1] + friend) + return {'shoot': score[0] + shoot, 'friend': score[1] + friend} else: dbadd_entry(nick, chan, db, conn, shoot, friend) + return {'shoot': shoot, 'friend': friend} def attack(nick, chan, message, db, conn, notice, attack): @@ -353,13 +355,12 @@ def attack(nick, chan, message, db, conn, notice, attack): status['duck_status'] = 2 try: - score = 1 args = { - attack_type: score + attack_type: 1 } - update_score(nick, chan, db, conn, **args) - except DatabaseError: + score = update_score(nick, chan, db, conn, **args)[attack_type] + except Exception: status['duck_status'] = 1 raise