add administration state handling
This commit is contained in:
parent
472ba06b94
commit
1a0a8eae73
13
main.py
13
main.py
|
@ -40,10 +40,23 @@ EVENTS = [
|
||||||
"part",
|
"part",
|
||||||
"invite",
|
"invite",
|
||||||
]
|
]
|
||||||
|
ADMINS = ['rndusr']
|
||||||
PREFIX = '*'
|
PREFIX = '*'
|
||||||
|
|
||||||
|
class Admin:
|
||||||
|
def __init__(self, nick):
|
||||||
|
self.nicks = []
|
||||||
|
self.nicks.append(nick)
|
||||||
|
def __eq__(self, val):
|
||||||
|
return val in self.nicks
|
||||||
|
def append(self, nick):
|
||||||
|
self.nicks.append(nick)
|
||||||
|
def remove(self, nick):
|
||||||
|
self.nicks.remove(nick)
|
||||||
|
|
||||||
class Server(BaseServer):
|
class Server(BaseServer):
|
||||||
handlers = {i: [] for i in EVENTS}
|
handlers = {i: [] for i in EVENTS}
|
||||||
|
admins = [Admin(i) for i in ADMINS]
|
||||||
states = {}
|
states = {}
|
||||||
async def line_read(self, line: Line):
|
async def line_read(self, line: Line):
|
||||||
print(f"{self.name} < {line.format()}")
|
print(f"{self.name} < {line.format()}")
|
||||||
|
|
Loading…
Reference in New Issue