From c5765cc5f690bb3c262628d549b117c725317f77 Mon Sep 17 00:00:00 2001 From: Dabo Ross Date: Mon, 13 Jan 2014 19:10:43 -0800 Subject: [PATCH] Add support for multiple channels to .join and .leave --- plugins/admin.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/plugins/admin.py b/plugins/admin.py index 37601b1..7813b64 100644 --- a/plugins/admin.py +++ b/plugins/admin.py @@ -138,8 +138,11 @@ def clearlogs(inp, input=None): @hook.command(permissions=["botcontrol"]) def join(inp, conn=None, notice=None): """join -- Joins .""" - notice("Attempting to join {}...".format(inp)) - conn.join(inp) + for target in inp.split(" "): + if not target.startswith("#"): + target = "#{}".format(target) + notice("Attempting to join {}...".format(target)) + conn.join(target) @hook.command(autohelp=False, permissions=["botcontrol"]) @@ -148,11 +151,14 @@ def part(inp, conn=None, chan=None, notice=None): If [channel] is blank the bot will leave the channel the command was used in.""" if inp: - target = inp + targets = inp else: - target = chan - notice("Attempting to leave {}...".format(target)) - conn.part(target) + targets = chan + for target in targets.split(" "): + if not target.startswith("#"): + target = "#{}".format(target) + notice("Attempting to leave {}...".format(target)) + conn.part(target) @hook.command(autohelp=False, permissions=["botcontrol"])