From 7beae067352699ca8ab95e13cbadeb63bbad5dd5 Mon Sep 17 00:00:00 2001 From: lickthecheese Date: Sun, 5 Apr 2020 19:27:06 -0400 Subject: [PATCH] hot reload --- modules/__pycache__/admin.cpython-36.pyc | Bin 392 -> 1262 bytes modules/admin.py | 31 ++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/modules/__pycache__/admin.cpython-36.pyc b/modules/__pycache__/admin.cpython-36.pyc index 6b5b44ee9fba7a1ad7ae7d91495bc97ca989e0cf..566ec770952bd8ce403acf6ac6e32a751286e459 100644 GIT binary patch literal 1262 zcmZux!EV$r5VhkZyWO@>3I~cf7zrVzg02JzBvb(h4&~Ad2c$}X(%9YgZW0IE3v`>F zwkN)UAK(l40KR~$ublV=PRw|_Z9ydK=Zx)n9?u)^gVojEx54MPKNulD$%O}O@*J9d z1R#i@CD|h)66}QRQ4xy-`bbh4iS$df$3#bTVI&qyq6d8<=qr*f{{mmKTg2GGgFUwI z(CkfsmW+UTMBAukvuH+N!cIGc0)lt6J6$_E=1!M_R}y-Dbeu&#em_yprw7_pxyxc7 zTUj3XxESWOPpzJqLV8x&!B=9su*L6t{h_X8zf{H84P`Nu(#pR6AnSYk+Vv|fCZ)9f zTvV#wY7R{VJ_*K$AA|<`>;O1%c7O&9JU~kYokfe#6^y;30i%HI(?eJlzaVcmk7JjN zQncE5gUl#J|L{HPv|ukd-rs$_V2;k2LsHo8^qP^S&V{N6{51Nlt*z-3p=)`I3njRP z^SU9>)a^teD?^M#-d;pm%D&d*QKl*qm%LXRq z3Gz#-YP4~s+V|-^03WMbxhyf55re5QDMAOpQx&p5hb0{8&AounqAqp~fY5cChIfUo z(HqoUg|RFONjJFQEc3VrvWL<+fsc^+vyw4&%SNaJJ!TGziHc}U?ERJrwm}>lcg#-6 zHI(k(8FdUi69FC@z}Z46LP4g;FpC#@)a$3d$=|+Ny8D~*UlhVI2-C-y;|9`dIn)~e zXf%p2aZcA9emI7e$MafnrY%@!UmOUg}~jMb`0MW#5H@ z^@(jtxDBk7weJ?Xs({&=9>n5VqZ=QOw5qfCe-izx&vIbg0fJI)0D-*(KtPrry$&+P z^iE{(&K7u5e6YuVi699sb|?ynu)VmyJ_(#4C_0*DfQ-&#!4fzx4s!*}+t3!b4(%*8 omvI$d#84Op!H)3MA)li48s*-8o1|?w~?^gm>_ZYvC1C z?Ajz^rJ0@8Y4&E%7mK6s&D-re0DLhH6|uTx_!A}r24CR@Ok`s2Xw)^N6Rr43N_x!r zWcX929`2#XK7NU=*t-T~W(VdehM6Vri!G%pC{OiWP`WIdF!k-uX$rCR+YfM4-tx1| z%GOd=SNfqVNtZ;Pvi6CZ<)-a2+nQZXJ}Zo^nzP5}Fdx*qXiQBK$IA_XE@9RvnoIg2 z>oE_Vq(y_PF=Ld6$*?Dl24je|H7PpTHKZD8#$!-bQ+1;DKh0U^e?}+6KZji823xWk KqhB0CCh8YNW=~H5 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):