X-Git-Url: https://jfr.im/git/erebus.git/blobdiff_plain/4df64299d7751fb90a9cf5e2964e9bcc365bcc3e..591964e837ca06bef75e99a022dbb09582488f51:/modules/foo.py diff --git a/modules/foo.py b/modules/foo.py index 9dbf29f..0278eb1 100644 --- a/modules/foo.py +++ b/modules/foo.py @@ -17,9 +17,20 @@ modstart = lib.modstart modstop = lib.modstop # module code -@lib.hook('test', needchan=False) -def cmd_gtest(bot, user, chan, realtarget, *args): - if realtarget == chan.name: replyto = chan +@lib.hook(needchan=False) #since no cmd= is provided, defaults to function name +@lib.help('', '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 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.', "it's a very non-sensical command", "more lines") +def foobar(bot, user, chan, realtarget, *args): + bot.msg(user, "Foo bar baz.") + +@lib.hook() +@lib.help(None, 'a command that does nothing but requires you specify a channel') +def needchan(bot, user, chan, realtarget, *args): + bot.msg(user, "You did it!")