Skip to content

Commit 27615fe

Browse files
authored
Merge pull request #157 from linuxdaemon/gonzobot+duckhunt-score-fix
Fix displayed score when beffing/shooting a duck
2 parents 67647e2 + 9febeb4 commit 27615fe

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

plugins/duckhunt.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,10 @@ def update_score(nick, chan, db, conn, shoot=0, friend=0):
281281
.where(table.c.name == nick.lower())).fetchone()
282282
if score:
283283
dbupdate(nick, chan, db, conn, score[0] + shoot, score[1] + friend)
284+
return {'shoot': score[0] + shoot, 'friend': score[1] + friend}
284285
else:
285286
dbadd_entry(nick, chan, db, conn, shoot, friend)
287+
return {'shoot': shoot, 'friend': friend}
286288

287289

288290
def attack(nick, chan, message, db, conn, notice, attack):
@@ -353,13 +355,12 @@ def attack(nick, chan, message, db, conn, notice, attack):
353355

354356
status['duck_status'] = 2
355357
try:
356-
score = 1
357358
args = {
358-
attack_type: score
359+
attack_type: 1
359360
}
360361

361-
update_score(nick, chan, db, conn, **args)
362-
except DatabaseError:
362+
score = update_score(nick, chan, db, conn, **args)[attack_type]
363+
except Exception:
363364
status['duck_status'] = 1
364365
raise
365366

0 commit comments

Comments
 (0)