import pyva_net_rizon_acid_core_Acidictive as Acidictive
import pyva_net_rizon_acid_core_AcidCore as AcidCore
import pyva_net_rizon_acid_core_User as User
+import pyva_net_rizon_acid_core_Channel as Channel
class trivia(
AcidPlugin,
cid = self.dbp.fetchone()[0]
return cid
+ def skip_trivia(self, cname):
+ '''Skips a trivia question and moves on to the next'''
+ if istring(cname) not in self.trivias:
+ return
+
+ self.trivias[istring(cname)].skip()
+
def stop_trivia(self, cname, forced):
'''Stops a trivia instance and removes it from our dict.'''
if istring(cname) not in self.trivias:
self.notice(sender, "Trivia: .strivia - to stop current round.")
self.notice(sender, "Trivia: .topten/.tt - lists top ten players.")
self.notice(sender, "Trivia: .rank [nick] - shows yours or given nicks current rank.")
- # Defunct in orig trivia
- #self.notice(sender, "Trivia: .next - skips question.")
+ self.notice(sender, "Trivia: .next - skips question. (Must be half operator or higher on the channel)")
self.notice(sender, "Trivia: .themes - lists available question themes.")
self.notice(sender, "Trivia: .theme set <name> - changes current question theme (must be channel founder).")
elif command == 'trivia':
self.notice(sender, "Checking if you are the channel founder.")
self.auth.request(sender, channel, 'set_theme_' + args[1])
+ elif command == 'skip' or command == 'next':
+ channelObj = Channel.findChannel(channel);
+
+ if not channelObj:
+ return
+
+ membership = channelObj.findUser(userinfo)
+
+ if not membership:
+ return
+
+ if not membership.isOp():
+ self.notice(sender, "You're not an (half)operator on the channel")
+ return
+
+ self.skip_trivia(channel)
else: # not a command, but might be an answer!
if istring(channel) not in self.trivias:
return # no trivia running, disregard that
self.module.msg(self.cname,
msg + " '.trivia [number]' to start playing again.")
+ def skip(self):
+ '''Stops the current question and asks the next question'''
+ try:
+ self.question_timer.stop()
+ self.hint_timer.stop()
+ except AttributeError:
+ return
+
+ self.answer = []
+ self.hints_given = 0
+ self.hint_timer = task.LoopingCall(self.ask)
+ self.hint_timer.start(5, False)
+
+ self.module.msg(self.cname, "Skipping question")