]> jfr.im git - erebus.git/blame - modules/foo.py
added help module
[erebus.git] / modules / foo.py
CommitLineData
9bd05cf6 1# Erebus IRC bot - Author: Erebus Team
931c88a4 2# simple module example
3# This file is released into the public domain; see http://unlicense.org/
4
e4255e70 5# module info
6modinfo = {
9bd05cf6 7 'author': 'Erebus Team',
e4255e70 8 'license': 'public domain',
9 'compatible': [1], # compatible module API versions
10 'depends': [], # other modules required to work properly?
11}
12
6c70d82c 13# preamble
14import modlib
15lib = modlib.modlib(__name__)
16modstart = lib.modstart
db50981b 17modstop = lib.modstop
6c70d82c 18
e4255e70 19# module code
fb20be7c 20@lib.hook(needchan=False) #since no cmd= is provided, defaults to function name
21@lib.help('<args>', 'tells you what you said')
22def test(bot, user, chan, realtarget, *args):
b79721ee 23 if chan is not None and realtarget == chan.name: replyto = chan
586997a7 24 else: replyto = user
25
8583bc12 26 bot.msg(replyto, "You said: %s" % (' '.join([str(arg) for arg in args])))
fb20be7c 27
28@lib.hook(('foo', 'bar'), needchan=False) #hooks !foo and !bar as aliases
0f8352dd 29@lib.help(None, 'replies with nonsense.', "it's a very non-sensical command", "more lines")
fb20be7c 30def foobar(bot, user, chan, realtarget, *args):
31 bot.msg(user, "Foo bar baz.")