diff --git a/modules/__pycache__/admin.cpython-36.pyc b/modules/__pycache__/admin.cpython-36.pyc index 6b5b44e..566ec77 100644 Binary files a/modules/__pycache__/admin.cpython-36.pyc and b/modules/__pycache__/admin.cpython-36.pyc differ diff --git a/modules/admin.py b/modules/admin.py index babdfa1..3b3bdf0 100644 --- a/modules/admin.py +++ b/modules/admin.py @@ -1,7 +1,36 @@ +import importlib + + +async def quit(self, chan, source, msg): + await self.quit('{} told me to {}'.format(source,msg)) + +async def reloadmods(self, chan, source, msg): + await self.message(chan, 'reloading modules...') + self.cmd = {} + self.raw = {} + self.help = {} + for i in self.modules: + importlib.reload(self.modules[i]) + await self.modules[i].init(self) + await self.message(chan, 'done! did something break? if so you might need to restart') + + + +commands = { + 'quit': quit, + 'reload': reloadmods +} async def adminHandle(self, chan, source, msg): - await self.message(chan, msg) + if await self.is_admin(source): + msg = msg.split(' ') + if len(msg) < 1 or not msg[0] in commands: + await self.message(chan, 'you press the wrong button on the oven and it burns you') + return + await commands[msg.pop(0)](self, chan, source, ' '.join(msg)) + else: + await self.message(chan, 'you try to open it, but the oven is locked') async def init(self):