From 523629d518155dd67b1937eaa5d93fd268abe1b8 Mon Sep 17 00:00:00 2001 From: minerobber Date: Thu, 28 Feb 2019 11:43:27 +0000 Subject: [PATCH] Move nomad to mainfunctions Also, take a list of admins from ~/minerbot.admins. --- plugins/mainfunctions.py | 18 +++++++++++++++++- plugins/nomad.py | 13 ------------- 2 files changed, 17 insertions(+), 14 deletions(-) delete mode 100644 plugins/nomad.py diff --git a/plugins/mainfunctions.py b/plugins/mainfunctions.py index fd8616a..1354438 100644 --- a/plugins/mainfunctions.py +++ b/plugins/mainfunctions.py @@ -1,6 +1,10 @@ import plugin, os -BOT_NICKS = ["minerobber"] +try: + with open(os.path.expanduser("~/minerbot.admins")) as f: + BOT_NICKS = [l.strip() for l in f if l.strip()] +except: + BOT_NICKS = ["minerobber"] @plugin.listener("admin") def admin(bot,channel,nick,msg): @@ -59,3 +63,15 @@ def minerbotsrc(bot,channel,nick,*args): @plugin.command("minerbothelp") def help(bot,channel,nick,*args): bot.say(channel,nick+": currently loaded commands: {}".format(", ".join("!"+cmd for cmd in plugin.cmds.keys()))) + +@plugin.command("minomad","") +def minomad(bot,channel,nick,*args): + if nick not in BOT_NICKS: return + args = list(args) + command = args.pop(0) + if command == "join": + for channel in args: + bot._bot.conn.join(channel) + elif command == "part": + for channel in args: + bot._bot.conn.part(channel,"Leaving...") diff --git a/plugins/nomad.py b/plugins/nomad.py deleted file mode 100644 index 58bbd2f..0000000 --- a/plugins/nomad.py +++ /dev/null @@ -1,13 +0,0 @@ -import plugin - -@plugin.command("minomad","") -def minomad(bot,channel,nick,*args): - if not bot.is_admin: return - args = list(args) - command = args.pop(0) - if command == "join": - for channel in args: - bot._bot.conn.join(channel) - elif command == "part": - for channel in args: - bot._bot.conn.part(channel,"Leaving...")