Skip to content

Instantly share code, notes, and snippets.

@jimeh
Created December 16, 2016 09:33
Show Gist options
  • Save jimeh/89128c303187eea3aa4a915b89b4540a to your computer and use it in GitHub Desktop.
Save jimeh/89128c303187eea3aa4a915b89b4540a to your computer and use it in GitHub Desktop.
# Let hubot chime in on certain discussions...
module.exports = (robot) ->
robot.hear /rewrite/i, (msg) ->
if shouldSpeak(0.1)
msg.send("#{msg.random(rewriteImages)}#.png")
robot.hear /refactor/i, (msg) ->
if shouldSpeak(0.1)
msg.send("#{msg.random(refactorImages)}#.png")
robot.hear /rtfm/i, (msg) ->
if shouldSpeak(0.4)
msg.send("#{msg.random(rtfmImages)}#.png")
shouldSpeak = (chance = 1) ->
Math.random() <= chance
rewriteImages = [
'http://i.imgur.com/ANbKe.png',
'http://i.imgur.com/Ugr7O.jpg',
'http://i.imgur.com/5ZOzM.jpg',
'http://i.imgur.com/goVrJ.jpg',
'http://i.imgur.com/H5Wks.jpg',
'http://i.imgur.com/GLJzz.jpg',
'http://i.imgur.com/oGS2e.jpg'
]
refactorImages = [
'http://i.imgur.com/wGUTG.gif',
'http://i.imgur.com/Ct6Ff.jpg',
'http://i.imgur.com/rwa0E.jpg',
'http://i.imgur.com/oYC8C.png',
'http://i.imgur.com/mCRH7.jpg',
'http://i.imgur.com/afyFr.jpg',
'http://i.imgur.com/jp4ss.jpg',
'http://i.imgur.com/Q4bI4.jpg'
]
rtfmImages = [
'http://i.imgur.com/jeZmD.jpg',
'http://i.imgur.com/nyh7F.jpg',
'http://i.imgur.com/YF9Zu.jpg',
'http://i.imgur.com/hC7Ei.jpg',
'http://i.imgur.com/z0r8Q.jpg',
'http://i.imgur.com/ey4CU.jpg',
'http://i.imgur.com/D4fdr.jpg',
'http://i.imgur.com/H3CPd.png',
'http://i.imgur.com/qpCH2.jpg',
'http://i.imgur.com/qpCH2.jpg'
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment