]> jfr.im git - irc/evilnet/x3.git/blame - src/plugins/annoy/plugin.py
Added new event hooks system and started migrating events to new system
[irc/evilnet/x3.git] / src / plugins / annoy / plugin.py
CommitLineData
07559983
AS
1# anoy module
2
50d61a79 3import _svc
07559983
AS
4
5class Annoy:
6
7 def __init__(self, handler, irc):
8 self.handler = handler
9 self.name = "annoy"
10
0ab7b4bc
AS
11# These hooks are for testing, and are commented out by default so as not to annoy
12# us unless we want to test them
13 #handler.addhook("join", self.on_join, "foobar")
14 #handler.addhook("nick_change", self.nick_change, ["Rubin", None], "testing")
15
07559983 16 handler.addcommand(self.name, "dance", self.dance)
039a6658 17 handler.addcommand(self.name, "nickof", self.nickof)
07559983
AS
18 self.test = "footest"
19
0bcdc113
AS
20# def on_join(self, irc, channel, nick):
21# irc.send_target_privmsg("x3", channel, "%s joined %s:%s "%(nick, channel, self.test))
07559983 22
0ab7b4bc 23 def nick_change(self, irc, nick, old_nick):
50d61a79 24 svcinfo = _svc.get_info()
0ab7b4bc
AS
25 # opserv pm #theops that someones nick changed
26 irc.send_target_privmsg(svcinfo["opserv"], "#theops", "%s changed nick to %s"%(old_nick, nick) )
27
07559983 28 def dance(self, irc, args):
0bcdc113 29 nick = irc.caller
50d61a79 30 user = _svc.get_user(nick)
0bcdc113
AS
31
32 reply = "Ok,"
33 if(user and "account" in user):
34 reply += " Mr. %s"%user["account"]
35
36 reply += " we can dance"
37 if(len(args)):
38 reply += " "
39 reply += args
40 reply += "."
41
42 irc.reply(reply)
07559983 43
039a6658 44 def nickof(self, irc, bot):
50d61a79 45 info = _svc.get_info()
039a6658
AS
46
47 if(bot and bot in info.keys()):
48 irc.reply("%s has nick %s"%(bot, info[bot]))
49 else:
50 irc.reply("I dunno. Try %s"%str(info.keys()))
51
07559983 52Class = Annoy