Skip to content

Instantly share code, notes, and snippets.

@timothyhahn
Created January 20, 2016 22:04
Show Gist options
  • Save timothyhahn/a444ea92e89da6993d9c to your computer and use it in GitHub Desktop.
Save timothyhahn/a444ea92e89da6993d9c to your computer and use it in GitHub Desktop.
# Description:
# Hits the Emojini API to find emojis related to an image.
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# emojini me <image url>
#
# Author:
# Curalate Dev Team <http://engineering.curalate.com>
#
module.exports = (robot) ->
robot.respond /emojini( me)? (.*)/i, (msg) ->
msg.http('https://emojini.curalate.com/v1/classify?url=' + msg.match[2])
.get() (err, res, body) ->
results = JSON.parse(body)
emojis = ''
(emojis += emoji.emoji.str for emoji in results.results)
msg.send 'Curalate\'s Emojini 3000 grants these emojis: ' + emojis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment