Split off admin command

This commit is contained in:
Robert Miles 2018-12-09 13:00:37 -05:00
parent 4d6048f2a4
commit e7a9ce0e09
3 changed files with 7 additions and 11 deletions

6
bot.py
View File

@ -24,10 +24,8 @@ class MinerbotPhoenix(teambot.Handler):
args = message[len(PREFIX):].split(" ")
cmd = args.pop(0).lower()
self.cmd = cmd
# print(cmd,args,hasattr(self,"on_{}".format(cmd)))
if cmd in plugin.cmds:
try:
# getattr(self,"on_{}".format(cmd))(channel,nick,*args)
plugin.cmds[cmd](self,channel,nick,*args)
except ValueError:
self.say(channel,"Usage: {}{} {}".format(PREFIX,cmd,HELP.get(cmd,"")))
@ -36,10 +34,6 @@ class MinerbotPhoenix(teambot.Handler):
self.say(channel,"ACCESS VIOLATION: "+traceback.format_exception_only(errcls,err)[0].strip())
print("On command `{}{} {}` by {}:".format(PREFIX,cmd," ".join(args),self.event.source))
traceback.print_exc()
def on_admin(self,channel,nick,subcmd,*args):
if not self.is_admin: return
if subcmd=="down":
self._bot.die("Stopping...")
def on_rollcall(self,channel,nick,*a):
self.say(channel,nick+": Hey! I'm minerbot! Commands: !mbtilde, !note, !backronym, !kwam, !su, !minerbot2src")
def on_mbtilde(self,channel,nick,subcmd,*args):

7
plugins/admin.py Normal file
View File

@ -0,0 +1,7 @@
import plugin
@plugin.command("admin","GO AWAY YOU DINKLEBERG")
def admin(bot,channel,nick,subcmd,*args):
if not bot.is_admin: return
if subcmd=="down":
bot._bot.die("Stopping...")

View File

@ -1,5 +0,0 @@
import plugin
@plugin.command("test","Just a test")
def test(bot,channel,nick,*args):
print(bot,channel,nick,*args)