From 0f31d7f5e21088a46bf1cf2f5f96ff40f157cc06 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Wed, 2 Oct 2019 13:46:02 +0100 Subject: [PATCH] Implement admall command to run commands as the administrative relay user --- commands/admall.py | 22 ++++++++++++++++++++++ conf/help.json | 1 + 2 files changed, 23 insertions(+) create mode 100644 commands/admall.py diff --git a/commands/admall.py b/commands/admall.py new file mode 100644 index 0000000..cbbf854 --- /dev/null +++ b/commands/admall.py @@ -0,0 +1,22 @@ +import main +from core.bot import deliverRelayCommands + +class AdmallCommand: + def __init__(self, *args): + self.admall(*args) + + def admall(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length): + if authed: + if length > 2: + for i in main.network.keys(): + for x in main.network[i].relays.keys(): + num = main.network[i].relays[x]["id"] + commands = {spl[1]: [" ".join(spl[2:])]} + success("Sending commands to relay %s" % (num)) + deliverRelayCommands(num, commands) + return + else: + incUsage("admall") + return + else: + incUsage(None) diff --git a/conf/help.json b/conf/help.json index 0a7ebff..37655a9 100644 --- a/conf/help.json +++ b/conf/help.json @@ -26,5 +26,6 @@ "token": "token [] []", "all": "all ", "allc": "allc <(network)|(alias)> ", + "admall": "admall ", "swho": "swho []" }