This repository was archived by the owner on Jun 8, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 2
2
#
3
3
# <thing>++ - give thing some karma
4
4
# <thing>-- - take away some of thing's karma
5
- # karma <thing> - check thing's karma, if <thing> is ommitted get top and bottom 3
5
+ # karma <thing> - check thing's karma, if <thing> is omitted get top and bottom 3
6
+ # karma empty <thing> - empty a thing's karma
6
7
class Karma
7
8
8
9
constructor : (@robot ) ->
@@ -19,7 +20,11 @@ class Karma
19
20
@robot .brain .on ' loaded' , =>
20
21
if @robot .brain .data .karma
21
22
@cache = @robot .brain .data .karma
22
-
23
+
24
+ kill : (thing ) ->
25
+ delete @cache [thing]
26
+ @robot .brain .data .karma = @cache
27
+
23
28
increment : (thing ) ->
24
29
@cache [thing] ?= 0
25
30
@cache [thing] += 1
@@ -62,6 +67,11 @@ module.exports = (robot) ->
62
67
karma .decrement subject
63
68
msg .send " #{ subject} #{ karma .decrementResponse ()} (Karma: #{ karma .get (subject)} )"
64
69
70
+ robot .respond / karma empty ? (\S + [^ -\s ] )$ / i , (msg ) ->
71
+ subject = msg .match [1 ].toLowerCase ()
72
+ karma .kill subject
73
+ msg .send " #{ subject} has had its karma scattered to the winds."
74
+
65
75
robot .respond / karma ? (\S + [^ -\s ] )? $ / i , (msg ) ->
66
76
if msg .match [1 ]
67
77
match = msg .match [1 ].toLowerCase ()
You can’t perform that action at this time.
0 commit comments