wildbit/beanstalk-code-snippet-bot

Duplicate code snippets

Closed this issue · 7 comments

Conditions for this to happen

  • @beanstalk-snippet-bot is invited to the channel
  • In the same channel use slash command /code [bs_url]

The bot hears that the message was posted to the channel and looks up the snippet. The slash command request is also sent to our server and looks up the snippet. Thus resulting in duplicate messages.

screen shot 2016-05-17 at 7 11 06 am

@okonet one solution is to remove the listener for ambient messages. This would fix it.

https://github.com/wildbit/beanstalk-code-snippet-bot/blob/master/src/bot.js#L43

PR?

Actually I disagree. AFAIK ambient is the only reason it works now... Or am I missing something?

Yeah, it would end up disabling the ability to listen to any message on in a channel that it's invited to.

Instead, on this listener maybe we could disable the lookup if we notice that /code is in the message.

Yeah, the latter should work I think.

Cool. I'll do this later tonight.