]> jfr.im git - erebus.git/commitdiff
added control module, with !die, to stop bot
authorzonidjan <redacted>
Tue, 17 Nov 2015 12:21:38 +0000 (06:21 -0600)
committerzonidjan <redacted>
Tue, 17 Nov 2015 12:21:38 +0000 (06:21 -0600)
modules/control.py [new file with mode: 0644]

diff --git a/modules/control.py b/modules/control.py
new file mode 100644 (file)
index 0000000..0448c49
--- /dev/null
@@ -0,0 +1,27 @@
+# Erebus IRC bot - Author: Erebus Team
+# !EVAL and !EXEC commands
+# This file is released into the public domain; see http://unlicense.org/
+
+# module info
+modinfo = {
+       'author': 'Erebus Team',
+       'license': 'public domain',
+       'compatible': [1],
+       'depends': [],
+}
+
+# preamble
+import modlib
+lib = modlib.modlib(__name__)
+modstart = lib.modstart
+modstop = lib.modstop
+
+# module code
+import sys
+import ctlmod
+
+
+@lib.hook('die', needchan=False, glevel=lib.MANAGER)
+def cmd_die(bot, user, chan, realtarget, *args):
+       sys.exit(0)
+       os._exit(0)