+ if len(args) > 1:
+ numpoints = int(args[1])
+ else:
+ numpoints = 1
+ balance = state.addpoint(whoto, numpoints)
+ bot.msg(chan, "%s gave %s %d points. New balance: %d" % (user, whoto, numpoints, balance))
+
+@lib.hook('setnext', clevel=lib.OP)
+@lib.argsGE(1)
+def cmd_setnext(bot, user, chan, realtarget, *args):
+ line = ' '.join([str(arg) for arg in args])
+ linepieces = line.split('*')
+ question = linepieces[0].strip()
+ answer = linepieces[1].strip()
+ state.nextq = {'question':question,'answer':answer}
+ bot.msg(user, "Done.")
+
+@lib.hook('skip', clevel=lib.KNOWN)
+def cmd_skip(bot, user, chan, realtarget, *args):
+ state.nextquestion()
+
+@lib.hook('start')
+def cmd_start(bot, user, chan, realtarget, *args):
+ if chan == realtarget: replyto = chan
+ else: replyto = user
+
+ if state.curq is None:
+ state.nextquestion()
+ else:
+ bot.msg(replyto, "Game is already started!")
+
+@lib.hook('stop', clevel=lib.KNOWN)
+def cmd_stop(bot, user, chan, realtarget, *args):
+ if chan == realtarget: replyto = chan
+ else: replyto = user
+
+ if state.curq is not None:
+ state.curq = None
+ bot.msg(chan, "Game ended by %s" % (user))
+ else:
+ bot.msg(replyto, "Game isn't running.")