]>
Commit | Line | Data |
---|---|---|
f717c856 | 1 | # Erebus IRC bot - Author: Erebus Team |
2 | # This file is released into the public domain; see http://unlicense.org/ | |
3 | ||
4 | # module info | |
5 | modinfo = { | |
6 | 'author': 'Erebus Team', | |
7 | 'license': 'public domain', | |
8 | 'compatible': [1,2], | |
9 | 'depends': [], | |
10 | 'softdeps': ['help'], | |
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 | @lib.hook(clevel=lib.OP) | |
21 | @lib.help('<message>', 'sends message to channel') | |
22 | @lib.argsGE(1) | |
23 | def cmsg(bot, user, chan, realtarget, *args): | |
24 | chan.msg(' '.join(args)) | |
25 | ||
26 | ||
27 | def _getbot(bot, user, chan, realtarget, *args): | |
28 | target = None | |
29 | if args[0][0] == "#": | |
30 | target = bot.parent.channel(args[0]) | |
31 | print "target = %s" % (target) | |
32 | if target is not None: | |
33 | sendbot = target.bot | |
34 | print "bot = %s" % (sendbot) | |
35 | else: | |
36 | target = args[0] | |
37 | sendbot = bot.parent.randbot() | |
38 | print "bot = random" | |
39 | return (target, sendbot) | |
40 | ||
41 | @lib.hook(glevel=lib.STAFF, needchan=False) | |
42 | @lib.help('<target> <message>', 'send message to target') | |
43 | @lib.argsGE(2) | |
44 | def msg(bot, user, chan, realtarget, *args): | |
45 | target, sendbot = _getbot(bot, user, chan, realtarget, *args) | |
46 | sendbot.msg(target, ' '.join(args[1:])) | |
47 | ||
48 | @lib.hook(glevel=lib.STAFF, needchan=False) | |
49 | @lib.help('<target> <message>', 'send message to target as PRIVMSG') | |
50 | def pmsg(bot, user, chan, realtarget, *args): | |
51 | target, sendbot = _getbot(bot, user, chan, realtarget, *args) | |
52 | sendbot.conn.send("PRIVMSG %s :%s" % (args[0], ' '.join(args[1:]))) | |
53 | ||
54 | @lib.hook() | |
55 | def moo(bot, user, chan, realtarget, *args): | |
56 | for i in [' .= , =.\n', " _ _ /'/ )\\,/,/(_ \\ \\\n", ' `//-.| ( ,\\\\)\\//\\)\\/_ ) |\n', " //___\\ `\\\\\\/\\\\/\\/\\\\///' /\n", ',-"~`-._ `"--\'_ `"""` _ \\`\'"~-,_\n', '\\ `-. \'_`. .\'_` \\ ,-"~`/\n', " `.__.-'`/ (-\\ /-) |-.__,'\n", ' || | \\O) /^\\ (O/ |\n', ' `\\\\ | / `\\ /\n', ' \\\\ \\ / `\\ /\n', " `\\\\ `-. /' .---.--.\\\n", " `\\\\/`~(, '() ('\n", ' /(O) \\\\ _,.-.,_)\n', " // \\\\ `\\'` /\n", ' / | || `""""~"`\n', " /' |__||\n", ' `o\n']: | |
57 | bot.fastmsg(chan, i.rstrip("\n")) |