monolith/commands/cmd.py

25 lines
786 B
Python
Raw Normal View History

import main
from core.bot import deliverRelayCommands
class Cmd:
def __init__(self, *args):
self.cmd(*args)
def cmd(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
if authed:
if length > 4:
if not spl[1] in main.relay.keys():
failure("No such relay: %s" % spl[1])
return
commands = {spl[3]: [" ".join(spl[4:])]}
print(" ".join(spl[4:]))
success("Sending commands to relay %s as user %s" % (spl[1], spl[2]))
deliverRelayCommands(spl[1], commands, user=spl[2])
return
else:
incUsage("cmd")
return
else:
incUsage(None)