Nicer syntax for the meme generator

This commit is contained in:
rnhmjoj 2015-09-26 17:26:39 +02:00
parent 5d668bec1f
commit b77dd53523

View File

@ -11,6 +11,10 @@
# Enrico Fasoli (fazo96) # Enrico Fasoli (fazo96)
module.exports = (robot) -> module.exports = (robot) ->
escape = (str) -> (str.replace /\ /g, '_').replace /-/g, '--'
robot.respond /meme (.+)/i, (res) -> robot.respond /meme (.+)/i, (res) ->
url = 'http://memegen.link/'+res.match[1]+'.jpg' text = res.match[1]
meme = (escape i.trim() for i in text.split ',').join '/'
url = 'http://memegen.link/' + meme + '.jpg'
res.send url res.send url