]> jfr.im git - erebus.git/blob - modules/module.py
Twitch module message altered
[erebus.git] / modules / module.py
1 # Erebus IRC bot - Author: John Runyon
2 # module control through irc
3 # This file is released into the public domain; see http://unlicense.org/
4
5 # module info
6 modinfo = {
7 'author': 'John Runyon (DimeCadmium)',
8 'license': 'public domain',
9 'compatible': [1], # compatible module API versions
10 'depends': [], # other modules required to work properly?
11 }
12
13 # preamble
14 import modlib
15 lib = modlib.modlib(__name__)
16 modstart = lib.modstart
17 modstop = lib.modstop
18
19 # module code
20 import ctlmod
21
22 @lib.hook('modload', needchan=False, glevel=lib.MANAGER)
23 @lib.argsEQ(1)
24 def cmd_modload(bot, user, chan, realtarget, *args):
25 okay = ctlmod.load(bot.parent, args[0])
26 if okay:
27 bot.msg(user, "Loaded %s" % (args[0]))
28 else:
29 bot.msg(user, "Error loading %s: %r" % (args[0], okay))
30
31 @lib.hook('modunload', needchan=False, glevel=lib.MANAGER)
32 @lib.argsEQ(1)
33 def cmd_modunload(bot, user, chan, realtarget, *args):
34 okay = ctlmod.unload(bot.parent, args[0])
35 if okay:
36 bot.msg(user, "Unloaded %s" % (args[0]))
37 else:
38 bot.msg(user, "Error unloading %s: %r" % (args[0], okay))
39
40 @lib.hook('modreload', needchan=False, glevel=lib.MANAGER)
41 @lib.argsEQ(1)
42 def cmd_modreload(bot, user, chan, realtarget, *args):
43 okay = ctlmod.reloadmod(bot.parent, args[0])
44 bot.msg(user, "Reloaded %s" % (args[0]))
45
46 @lib.hook('modlist', needchan=False, glevel=lib.STAFF)
47 @lib.argsEQ(0)
48 def cmd_modlist(bot, user, chan, realtarget, *args):
49 mods = ctlmod.modules
50 for mod in mods.itervalues():
51 bot.msg(user, "- %s %r" % (mod.__name__, mod))
52 bot.msg(user, "Done.")