Skip to content

Instantly share code, notes, and snippets.

@sizovs
Created July 2, 2017 18:21
Show Gist options
  • Save sizovs/645d6237503912dd190f06f31df1f4f5 to your computer and use it in GitHub Desktop.
Save sizovs/645d6237503912dd190f06f31df1f4f5 to your computer and use it in GitHub Desktop.
const request = require("request");
module.exports = controller => {
controller.on('slash_command', (bot, message) => {
if (message.command != "/pic") {
return;
}
request.get("http://random.cat/meow", (error, response, body) => {
const url = JSON.parse(body).file;
bot.reply(message, {
attachments: [
{
title: "Fabulous cat",
image_url: url
}
]
});
});
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment