]> jfr.im git - erebus.git/blobdiff - modules/foo.py
misc
[erebus.git] / modules / foo.py
index f5a69fe0760a4ddc612daa3212d6c84e51252893..526fdff1d6c9c405bcb5f6e83d6d1bb8b53c08d4 100644 (file)
@@ -1,10 +1,10 @@
-# Erebus IRC bot - Author: John Runyon
+# Erebus IRC bot - Author: Erebus Team
 # simple module example
 # This file is released into the public domain; see http://unlicense.org/
 
 # module info
 modinfo = {
-       'author': 'John Runyon (DimeCadmium)',
+       'author': 'Erebus Team',
        'license': 'public domain',
        'compatible': [1], # compatible module API versions
        'depends': [], # other modules required to work properly?
@@ -17,8 +17,15 @@ modstart = lib.modstart
 modstop = lib.modstop
 
 # module code
-import ctlmod
+@lib.hook(needchan=False) #since no cmd= is provided, defaults to function name
+@lib.help('<args>', 'tells you what you said')
+def test(bot, user, chan, realtarget, *args):
+       if chan is not None and realtarget == chan.name: replyto = chan
+       else: replyto = user
 
-@lib.hook('test')
-def cmd_test(bot, user, chan, realtarget, *args):
-       bot.msg(chan, "You said: !test %s" % (' '.join([str(arg) for arg in args])))
+       bot.msg(replyto, "You said: %s" % (' '.join([str(arg) for arg in args])))
+
+@lib.hook(('foo', 'bar'), needchan=False) #hooks !foo and !bar as aliases
+@lib.help(None, 'replies with nonsense.', cmd=('foo', 'bar'))
+def foobar(bot, user, chan, realtarget, *args):
+       bot.msg(user, "Foo bar baz.")