convo.ask('What is your favorite team?', function(response, convo1) {
if(response.type=="slash_command"){
convo1.context.bot.replyAcknowledge()
convo1.context.bot.reply(response,"Slash command")
convo1.next();
}else{
convo1.next();
convo1.say('Cool, I like team' + response.text)
}
})
edit.
The Botkit conversation system doesn't work with Slash commands. Slash commands should be "top level" commands rather than answers to prompts within a conversation.
The isuue is if there is a ongoing conversation between bot and a user and user tries slash command instead of replying to question.Slash command message comes as response in conversation instead of going to slash command listener.That is why i am trying to handle it inside conversation.
hey @Vishvadeep93 you could try to apply middleware to exclude slash commands from conversations at all.
controller.middleware.receive.use(function (bot, message, next) {
if (message.type === 'slash_command') {
return bot.botkit.trigger(message.type, [bot, message]);
}
next();
});
Good suggestion, @ihorrusinko! This is exactly what I'd recommend.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
hey @Vishvadeep93 you could try to apply middleware to exclude slash commands from conversations at all.