]>
Commit | Line | Data |
---|---|---|
f717c856 | 1 | # Erebus IRC bot - Author: Erebus Team |
4477123d | 2 | # vim: fileencoding=utf-8 |
bac69af4 | 3 | # Commands to message various destinations |
f717c856 | 4 | # This file is released into the public domain; see http://unlicense.org/ |
5 | ||
6 | # module info | |
7 | modinfo = { | |
8 | 'author': 'Erebus Team', | |
9 | 'license': 'public domain', | |
fa93b933 | 10 | 'compatible': [0], |
f717c856 | 11 | 'depends': [], |
12 | 'softdeps': ['help'], | |
13 | } | |
14 | ||
15 | # preamble | |
16 | import modlib | |
17 | lib = modlib.modlib(__name__) | |
18 | modstart = lib.modstart | |
19 | modstop = lib.modstop | |
20 | ||
21 | # module code | |
52e1dab3 | 22 | import time |
23 | ||
adbee2da | 24 | @lib.hook(('say','cmsg'), clevel=lib.OP) |
f717c856 | 25 | @lib.help('<message>', 'sends message to channel') |
26 | @lib.argsGE(1) | |
adbee2da | 27 | def say(bot, user, chan, realtarget, *args): |
f717c856 | 28 | chan.msg(' '.join(args)) |
29 | ||
30 | ||
31 | def _getbot(bot, user, chan, realtarget, *args): | |
32 | target = None | |
fd07173d | 33 | if args[0].startswith("#"): |
f717c856 | 34 | target = bot.parent.channel(args[0]) |
f717c856 | 35 | sendbot = target.bot |
f717c856 | 36 | else: |
37 | target = args[0] | |
38 | sendbot = bot.parent.randbot() | |
f717c856 | 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 | ||
52e1dab3 | 54 | @lib.hook(glevel=lib.MANAGER, needchan=False) |
55 | @lib.argsEQ(1) | |
f717c856 | 56 | def moo(bot, user, chan, realtarget, *args): |
52e1dab3 | 57 | lines= [' .= , =.', " _ _ /'/ )\\,/,/(_ \\ \\", ' `//-.| ( ,\\\\)\\//\\)\\/_ ) |', " //___\\ `\\\\\\/\\\\/\\/\\\\///' /", ',-"~`-._ `"--\'_ `"""` _ \\`\'"~-,_', '\\ `-. \'_`. .\'_` \\ ,-"~`/', " `.__.-'`/ (-\\ /-) |-.__,'", ' || | \\O) /^\\ (O/ |', ' `\\\\ | / `\\ /', ' \\\\ \\ / `\\ /', " `\\\\ `-. /' .---.--.\\", " `\\\\/`~(, '() ('", ' /(O) \\\\ _,.-.,_)', " // \\\\ `\\'` /", ' / | || `""""~"`', " /' |__||", ' `o'] |
6da88962 | 58 | bots = list(bot.parent.bots.values()) |
52e1dab3 | 59 | for i in range(len(lines)): |
6da88962 | 60 | sender = bots[i%len(bots)] |
52e1dab3 | 61 | mylen = len(sender.nick) |
62 | padding = 15-mylen | |
63 | sender.fastmsg(args[0], " "*padding + lines[i]) |