Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Botkit Studio error when the bot is mentioned in a channel with and empty mention #19

Open
vicyankoff opened this issue Jun 20, 2017 · 1 comment
Labels

Comments

@vicyankoff
Copy link

Hi all,

I successfully installed and ran the bot-start-slack example app. The bot communicates with me fine when I talk to it via direct message. Commands such as hello, thanks, uptime etc work in DM.

I found a case that causes Botkit Studio to crash. Here's how to replicate it.

  1. Invite the bot to a channel, for example random.
  2. Do an empty mention of the bot, for example "@MYBOT " and hit enter
  3. Botkit Studio will send a message to the channel "I experienced an error with a request to Botkit Studio: undefined"

This error message comes from the catch clause on line 142
.catch(function(err) {
bot.reply(message, 'I experienced an error with a request to Botkit Studio: ' + err);
debug('Botkit Studio: ', err);
});

When you do an empty mention of the bot, the message.text is "" and it causes botkit studio to crash. This only happens on a mention, so If I call
controller.studio.runTrigger(bot, "", message.user, message.channel) the error is not triggered.

@peterswimm peterswimm added the bug label Jun 20, 2017
@shishirsharma
Copy link
Contributor

shishirsharma commented Oct 16, 2017

As a stop gap please use this in .catch({...})

}).catch(function(error) {
    debug('error', error);
    // bot.reply(message, 'I experienced an error with a request to Botkit Studio: ' + error);
    controller.studio.run(bot, 'fallback', message.user, message.channel);
  });

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants