Remove minerbot2src command, split off stevenuniverse command
This commit is contained in:
parent
b31aa3894a
commit
cf08125d1b
13
bot.py
13
bot.py
|
@ -1,4 +1,4 @@
|
|||
import teambot, sys, traceback, requests, random, words, markovuniverse, imp, plugin, os
|
||||
import teambot, sys, traceback, requests, random, words, imp, plugin, os
|
||||
from titlecase import titlecase
|
||||
|
||||
BOTOP = "~minerobber@127.0.0.1"
|
||||
|
@ -75,17 +75,6 @@ class MinerbotPhoenix(teambot.Handler):
|
|||
self.say(channel,nick+": "+titlecase(" ".join(result)))
|
||||
def on_kwam(self,channel,nick,*a):
|
||||
self.on_backronym(channel,nick,"kwam")
|
||||
def on_stevenuniverse(self,channel,nick,subcmd,*args):
|
||||
# print(channel,nick,subcmd,args)
|
||||
if not subcmd: subcmd="help"
|
||||
if subcmd=="help":
|
||||
self.say(channel,nick+": Current subcommands: !{cmd} fake-leak".format(cmd=self.cmd))
|
||||
elif subcmd=="fake-leak":
|
||||
self.say(channel,nick+": {} - {}".format(*markovuniverse.new_episode()))
|
||||
def on_su(self,channel,nick,*args):
|
||||
self.on_stevenuniverse(channel,nick,*args)
|
||||
def on_minerbot2src(self,channel,nick,*a):
|
||||
self.say(channel,nick+": https://tildegit.org/khuxkm/minerbot2")
|
||||
|
||||
if __name__=="__main__":
|
||||
words.loadDict("words")
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
import markovuniverse,plugin,sys
|
||||
|
||||
SUBCMDS = dict()
|
||||
USAGE = dict()
|
||||
|
||||
def reg_subcmd(name,format=""):
|
||||
def _register(func):
|
||||
SUBCMDS[name]=func
|
||||
USAGE[name]=" ".join(filter(None,[name,format]))
|
||||
return _register
|
||||
|
||||
@plugin.command("stevenuniverse","<subcmd> [args]")
|
||||
def stevenuniverse(bot,channel,nick,subcmd=None,*args):
|
||||
if not subcmd: subcmd = "help"
|
||||
if subcmd not in SUBCMDS: subcmd = "help"
|
||||
try:
|
||||
SUBCMDS[subcmd](bot,channel,nick,*args)
|
||||
except ValueError:
|
||||
bot.say("Usage: !{} {}".format(bot.cmd,USAGE[subcmd]))
|
||||
except:
|
||||
print("!{} {} {}".format(bot.cmd,subcmd," ".join(args)))
|
||||
raise
|
||||
|
||||
plugin.alias("su","stevenuniverse")
|
||||
|
||||
@reg_subcmd("help")
|
||||
def help(bot,channel,nick,*a):
|
||||
bot.say(channel,"{}: Current !{} subcommands are {}".format(nick,bot.cmd,", ".join(SUBCMDS.keys())))
|
||||
|
||||
@reg_subcmd("fake-leak")
|
||||
def fakeleak(bot,channel,nick,*a):
|
||||
bot.say(channel,nick+": {} - {}".format(*markovuniverse.new_episode()))
|
Loading…
Reference in New Issue