]>
jfr.im git - z_archive/Ophion.git/blob - modules/autoload/adminmsg.py
4 name
= 'admin messaging'
6 cache
.currmod
= __name__
7 cache
.hookcmd('ADMINSEND', 2, send
, 3, helpsend
, isadmin
=True)
8 cache
.hookcmd('ADMINACT', 2, act
, 3, helpact
, isadmin
=True)
10 cache
.currmod
= __name__
11 cache
.unhookcmd('ADMINSEND')
12 cache
.unhookcmd('ADMINACT')
14 def send(nick
, target
, params
, bot
, cache
):
15 pieces
= params
.split()
19 msg
= ' '.join(pieces
[2:])
21 for bot
in cache
.bots
.values():
22 if bot
.online
: bot
.msg(target
, msg
)
23 elif cache
.isonline(bid
):
24 cache
.bots
[bid
].msg(target
, msg
)
26 bot
.msg(nick
, "No such bot, or offline.")
27 def act(nick
, target
, params
, bot
, cache
):
28 pieces
= params
.split()
32 msg
= ' '.join(pieces
[2:])
34 for bot
in cache
.bots
.values():
35 if bot
.online
: bot
.raw("PRIVMSG %s :\1ACTION %s\1" % (target
, msg
))
36 elif cache
.isonline(bid
):
37 cache
.bots
[bid
].raw("PRIVMSG %s :\1ACTION %s\1" % (target
, msg
))
39 bot
.msg(nick
, "No such bot, or offline.")
42 def helpsend(): return ['ADMINSEND <bid> <nick|#channel> <msg>', 'Sends a PRIVMSG (#channel) or NOTICE (nick).']
43 def helpact(): return ['ADMINACT <bid> <nick|#channel> <msg>', 'Sends an ACTION (/me).']