asjon/scripts/memes.coffee
2015-09-26 17:26:39 +02:00

21 lines
476 B
CoffeeScript

# Description:
# makes dank maymays
#
# Commands:
# hubot meme <template>,<upper title>,<lower title> - genera un meme
#
# Configuration:
# None
#
# Author:
# Enrico Fasoli (fazo96)
module.exports = (robot) ->
escape = (str) -> (str.replace /\ /g, '_').replace /-/g, '--'
robot.respond /meme (.+)/i, (res) ->
text = res.match[1]
meme = (escape i.trim() for i in text.split ',').join '/'
url = 'http://memegen.link/' + meme + '.jpg'
res.send url