X-Git-Url: https://jfr.im/git/erebus.git/blobdiff_plain/963f2522b39c57a38f9cc05aa66c9d504162a54d..2bb267e013821f3adf661694308727beb0adf213:/modules/trivia.py diff --git a/modules/trivia.py b/modules/trivia.py index d1455bb..ae9a74e 100644 --- a/modules/trivia.py +++ b/modules/trivia.py @@ -53,8 +53,9 @@ def pts(num): return str(state.db['users'][state.db['ranks'][num]]['points']) except IndexError: return 0 + def country(num, default="??"): - return lib.mod('userinfo')._get(person(num), 'country', default=default) + return lib.mod('userinfo')._get(person(num), 'country', default=default).upper() class MyTimer(threading._Timer): def __init__(self, *args, **kwargs): @@ -129,9 +130,7 @@ class TriviaState(object): revealloc = findnth(''.join(self.hintstr), '*', revealcount) self.revealpossibilities.remove(revealcount) self.hintstr[revealloc] = answer[revealloc] - if oldhintstr != ''.join(self.hintstr): pass - else: self.hintstr = self.hintstr.append("!") - self.getchan().fastmsg("\00304,01Here's a hint: %s" % (''.join(self.hintstr))) + if oldhintstr != ''.join(self.hintstr): self.getchan().fastmsg("\00304,01Here's a hint: %s" % (''.join(self.hintstr))) self.hintsgiven += 1 @@ -530,7 +529,7 @@ def top10(bot, user, chan, realtarget, *args): max = len(state.db['ranks']) if max > 10: max = 10 - replylist = ', '.join(["%s (%s) %s" % (person(x), country(x, "unknown"), pts(x)) for x in range(max)]) + replylist = ', '.join(["%s (%s) %s" % (person(x), country(x), pts(x)) for x in range(max)]) bot.msg(state.db['chan'], "Top 10: %s" % (replylist)) @lib.hook(glevel=lib.ADMIN, needchan=False) @@ -631,29 +630,29 @@ def addq(bot, user, chan, realtarget, *args): @lib.hook(needchan=False) def triviahelp(bot, user, chan, realtarget, *args): - bot.msg(user, "START") - bot.msg(user, "TOP10") - bot.msg(user, "POINTS []") - bot.msg(user, "RANK []") - bot.msg(user, "BADQ (include info to identify question)") + bot.slowmsg(user, "START") + bot.slowmsg(user, "TOP10") + bot.slowmsg(user, "POINTS []") + bot.slowmsg(user, "RANK []") + bot.slowmsg(user, "BADQ (include info to identify question)") if user.glevel >= 1: - bot.msg(user, "SKIP (>=KNOWN)") - bot.msg(user, "STOP (>=KNOWN)") - bot.msg(user, "FINDQ (>=KNOWN)") + bot.slowmsg(user, "SKIP (>=KNOWN)") + bot.slowmsg(user, "STOP (>=KNOWN)") + bot.slowmsg(user, "FINDQ (>=KNOWN)") if user.glevel >= lib.STAFF: - bot.msg(user, "GIVE [] (>=STAFF)") - bot.msg(user, "SETNEXT * (>=STAFF)") - bot.msg(user, "ADDQ * (>=STAFF)") - bot.msg(user, "DELETEQ * (>=STAFF) [aka DELQ]") - bot.msg(user, "BADQS (>=STAFF)") - bot.msg(user, "CLEARBADQS (>=STAFF)") - bot.msg(user, "DELBADQ (>=STAFF)") + bot.slowmsg(user, "GIVE [] (>=STAFF)") + bot.slowmsg(user, "SETNEXT * (>=STAFF)") + bot.slowmsg(user, "ADDQ * (>=STAFF)") + bot.slowmsg(user, "DELETEQ * (>=STAFF) [aka DELQ]") + bot.slowmsg(user, "BADQS (>=STAFF)") + bot.slowmsg(user, "CLEARBADQS (>=STAFF)") + bot.slowmsg(user, "DELBADQ (>=STAFF)") if user.glevel >= lib.ADMIN: - bot.msg(user, "SETTARGET (>=ADMIN)") - bot.msg(user, "MAXMISSED (>=ADMIN)") - bot.msg(user, "HINTTIMER (>=ADMIN)") - bot.msg(user, "HINTNUM (>=ADMIN)") - bot.msg(user, "QUESTIONPAUSE (>=ADMIN)") + bot.slowmsg(user, "SETTARGET (>=ADMIN)") + bot.slowmsg(user, "MAXMISSED (>=ADMIN)") + bot.slowmsg(user, "HINTTIMER (>=ADMIN)") + bot.slowmsg(user, "HINTNUM (>=ADMIN)") + bot.slowmsg(user, "QUESTIONPAUSE (>=ADMIN)") @lib.hooknum(417) def num_417(bot, textline):