]> jfr.im git - erebus.git/commitdiff
trivia - allow to set topic via services
authorzonidjan <redacted>
Mon, 14 May 2018 08:31:54 +0000 (03:31 -0500)
committerzonidjan <redacted>
Mon, 14 May 2018 08:31:54 +0000 (03:31 -0500)
bot.config.example
modules/trivia.py

index 328d783b7f64d8adbb5378b846eafddb43bb9100..24d6a19d50b89a0b6a2ae6c88fe1b59639c46efc 100644 (file)
@@ -22,6 +22,7 @@ con = twitter consumer
 con_sec = twitter consumer secret
 token = twitter token
 token_sec = twitter token secret
+topiccommand = TOPIC %(chan)s :%(topic)s
 
 [sms]
 account_sid = twilio AccountSid
index 9f7624fef960c252e90287bb100fbcff5666d00e..8b278f369ad0280bf4b9b2d53c736e0d9d719d38 100644 (file)
@@ -851,7 +851,8 @@ def triviahelp(bot, user, chan, realtarget, *args):
                                bot.slowmsg(user, "HINTNUM       <hints>           (ADMIN)")
                                bot.slowmsg(user, "QUESTIONPAUSE <float seconds>   (ADMIN)")
 
-@lib.hooknum(332)
+@lib.hooknum(332) # topic is...
+@lib.hooknum(331) # no topic set
 def num_TOPIC(bot, textline):
        pieces = textline.split(None, 4)
        chan = pieces[3]
@@ -884,7 +885,7 @@ def num_TOPIC(bot, textline):
                'category': state.db['category'],
        }
        if gottopic != formatted:
-               state.getbot().conn.send("TOPIC %s :%s" % (state.db['chan'], formatted))
+               state.getbot().conn.send(bot.parent.cfg.get('trivia', 'topiccommand', default="TOPIC %(chan)s :%(topic)s") % {'chan': state.db['chan'], 'topic': formatted})
 
 
 def specialQuestion(oldq):