1 #karma module for scrappy
5 plusexp
= re
.compile('\+\+$')
6 minusexp
= re
.compile('\-\-$')
8 #this needs to be stored in sql or a text file or something
12 scrap
.register_event("msg", karma_look
)
13 scrap
.register_event("msg", karma_cmd
)
15 def karma_look(c
,list,bot
):
16 """ Should not be called directly """
19 if plusexp
.search(list[4]):
20 name
= list[4].split("++")[0]
21 newname
= name
.lower()
22 if newname
== nick
.lower():
23 c
.privmsg(list[5], "No touching yourself, %s." % nick
)
26 karma
[newname
] = karma
[newname
] + 1
30 c
.privmsg(list[5],"%s karma increased to %s" %
31 (name
,karma
[newname
]))
32 if minusexp
.search(list[4]):
33 name
= list[4].split("--")[0]
34 newname
= name
.lower()
35 if newname
== nick
.lower():
36 c
.privmsg(list[5], "No touching yourself, %s." % nick
)
39 karma
[newname
] = karma
[newname
] - 1
43 c
.privmsg(list[5],"%s karma decreased to %s" %
44 (name
,karma
[newname
]))
46 def karma_cmd(c
,list,bot
):
47 """ Tells the karma of the argument. """
48 cmd
= list[4].split(" ")[0]
50 if list[3] and cmd
== "karma":
51 name
= list[4].split(" ")[1]
52 newname
= name
.lower()
55 karma
[newname
] = karma
[newname
]
57 c
.privmsg(list[5],"%s is not in the karma database." %
61 c
.privmsg(list[5],"%s karma is %s" % (name
,karma
[newname
]))