add default module

This commit is contained in:
randomuser 2021-08-02 20:43:02 -05:00
parent a96019ca07
commit db61080a49
2 changed files with 8 additions and 3 deletions

6
default.py Normal file
View File

@ -0,0 +1,6 @@
def cmd(line, srv):
splitted = line.params[1].split(' ')
command = splitted[0][1:]
if command == "load":
srv.load_mod(splitted[1])
print("loaded")

View File

@ -29,8 +29,7 @@ class Server(BaseServer):
print(f"{self.name} < {line.format()}")
if line.command == "001":
await self.send(build("JOIN", ["#testchannel"]))
self.load_mod("test")
self.load_mod("test2")
self.load_mod("default")
self.event_handle(line)
def load_mod(self, name):
@ -55,7 +54,7 @@ class Server(BaseServer):
if event == None: return False
try:
for i in self.handlers[event]:
i(line)
i(line, self)
except IndexError: return False
return True