2019-01-26 18:58:21 +00:00
|
|
|
import main
|
|
|
|
from core.bot import deliverRelayCommands
|
|
|
|
|
2019-08-09 22:06:34 +00:00
|
|
|
class CmdCommand:
|
2019-01-26 18:58:21 +00:00
|
|
|
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)
|