Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit 742eb92

Browse files
author
Gabriel Guzman
committed
Latest version of goodbad.
1 parent c8e2b3e commit 742eb92

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/scripts/goodbad.coffee

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,13 @@ class GoodBad
2828
maxBadNum
2929
goodlist: -> @goodcache
3030
badlist: -> @badcache
31-
good: (msg) ->
32-
goodString = msg.match[2]
33-
goodthing = {num: @nextGoodNum(), user: user, good: goodString}
31+
good: (goodString) ->
32+
goodthing = {num: @nextGoodNum(), good: goodString}
3433
@goodcache.push goodthing
3534
@robot.brain.data.good = @goodcache
3635
goodthing
37-
bad: (msg) ->
38-
badString = msg.match[2]
39-
user = msg.message.user.name
40-
badthing = {num: @nextBadNum(), user: user, bad: badString}
36+
bad: (badString) ->
37+
badthing = {num: @nextBadNum(), bad: badString}
4138
@badcache.push badthing
4239
@robot.brain.data.bad = @badcache
4340
badthing
@@ -52,11 +49,13 @@ module.exports = (robot) ->
5249
goodbad = new GoodBad robot
5350

5451
robot.respond /(good) (.+?)$/i, (msg) ->
55-
good = goodbad.good msg
52+
message = "#{msg.message.user.name}: #{msg.match[2]}"
53+
good = goodbad.good message
5654
msg.send "The sprint is thriving!"
5755

5856
robot.respond /(bad) (.+?)$/i, (msg) ->
59-
bad = goodbad.bad msg
57+
message = "#{msg.message.user.name}: #{msg.match[2]}"
58+
bad = goodbad.bad message
6059
msg.send "The sprint is festering..."
6160

6261
robot.respond /(goodlist)/i, (msg) ->

0 commit comments

Comments
 (0)