Skip to content

Instantly share code, notes, and snippets.

@sizovs
Created July 2, 2017 18:22
Show Gist options
  • Save sizovs/c9ec9fc9865709e5a458446b29143570 to your computer and use it in GitHub Desktop.
Save sizovs/c9ec9fc9865709e5a458446b29143570 to your computer and use it in GitHub Desktop.
module.exports = controller => {
controller.on('interactive_message_callback', (bot, trigger) => {
trigger.actions.forEach(action => {
if (action.name.match(/^recommend/)) {
var reply = trigger.original_message;
reply.attachments.forEach(attachment => {
attachment.actions = [];
});
var person = `<@${trigger.user}>`;
var text = `${person} has replied ${action.value}`;
reply.attachments.push({
text: text
});
bot.replyInteractive(trigger, reply);
}
})
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment