+ bot.msg(replyto, "%s is in %d place (%s points). Target is: %s (%s points)." % (who, state.rank(who), state.points(who), state.targetuser(who), state.targetpoints(who)))
+
+@lib.hook('top10', needchan=False)
+def cmd_top10(bot, user, chan, realtarget, *args):
+ if len(state.db['ranks']) == 0:
+ return bot.msg(state.db['chan'], "No one is ranked!")
+
+ replylist = []
+ for nick in state.db['ranks'][0:10]:
+ user = state.db['users'][nick]
+ replylist.append("%s (%s)" % (user['realnick'], user['points']))
+ bot.msg(state.db['chan'], ', '.join(replylist))
+
+@lib.hook('settarget', clevel=lib.MASTER, needchan=False)
+def cmd_settarget(bot, user, chan, realtarget, *args):
+ try:
+ state.db['target'] = int(args[0])
+ bot.msg(state.db['chan'], "Target has been changed to %s points!" % (state.db['target']))
+ except:
+ bot.msg(user, "Failed to set target.")
+
+@lib.hook('triviahelp', needchan=False)
+def cmd_triviahelp(bot, user, chan, realtarget, *args):
+ bot.msg(user, "POINTS [<user>]")
+ bot.msg(user, "START")
+ bot.msg(user, "RANK [<user>]")
+ bot.msg(user, "TOP10")
+
+ if bot.parent.channel(state.db['chan']).levelof(user.auth) >= lib.KNOWN:
+ bot.msg(user, "SKIP (>=KNOWN )")
+ bot.msg(user, "STOP (>=KNOWN )")
+ if bot.parent.channel(state.db['chan']).levelof(user.auth) >= lib.OP:
+ bot.msg(user, "GIVE <user> [<points>] (>=OP )")
+ bot.msg(user, "SETNEXT <q>*<a> (>=OP )")
+ if bot.parent.channel(state.db['chan']).levelof(user.auth) >= lib.MASTER:
+ bot.msg(user, "SETTARGET <points> (>=MASTER)")
+
+
+def specialQuestion(oldq):
+ newq = {'question': oldq['question'], 'answer': oldq['answer']}
+ qtype = oldq['question'].upper()
+
+ if qtype == "!MONTH":
+ newq['question'] = "What month is it currently (in UTC)?"
+ newq['answer'] = time.strftime("%B").lower()
+ elif qtype == "!MATH+":
+ randnum1 = random.randrange(0, 11)
+ randnum2 = random.randrange(0, 11)
+ newq['question'] = "What is %d + %d?" % (randnum1, randnum2)
+ newq['answer'] = spellout(randnum1+randnum2)
+ return newq
+
+def spellout(num):
+ return [
+ "zero", "one", "two", "three", "four", "five", "six", "seven", "eight",
+ "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen",
+ "sixteen", "seventeen", "eighteen", "nineteen", "twenty"
+ ][num]