-
Notifications
You must be signed in to change notification settings - Fork 6
/
admincmd.py
34 lines (27 loc) · 832 Bytes
/
admincmd.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# -*- coding: utf-8 -*-
# vim:set ts=8 sts=8 sw=8 tw=80 noet cc=80:
from module import Module, COMMAND
class AdminCMD(Module):
def __init__(self, **keywords):
super(AdminCMD, self).__init__([COMMAND], name=__name__,
**keywords)
def register(self):
self.send_cmd("register_cli", name=["kick"], argc=1, undo=False)
self.send_cmd("register_cli", name=["kick"], argc=2, undo=False)
def unregister(self):
self.send_cmd("unregister_cli", name=["kick"], argc=1)
self.send_cmd("unregister_cli", name=["kick"], argc=2)
def start(self):
self.register()
def stop(self):
self.unregister()
def command(self, cmd, **keywords):
if cmd == "reregister_cli":
self.register()
return
if cmd != "cli_cmd":
return
cmd = keywords["command"]
args = keywords["args"]
if cmd == ["kick"]:
self.kick(*args)