Skip to content

Commit

Permalink
Only provide slack_message.id if using the RTM API
Browse files Browse the repository at this point in the history
When sec with postMessage, the id seems to prevent 
posting messages with the same id (e.g. after slackbot restart)
  • Loading branch information
clintam committed Mar 2, 2016
1 parent 11ee6e8 commit 11bc225
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Slackbot_worker.js
Expand Up @@ -180,7 +180,6 @@ module.exports = function(botkit, config) {
* Construct a valid slack message.
*/
var slack_message = {
id: message.id || bot.msgcount,
type: message.type || 'message',
channel: message.channel,
text: message.text || null,
Expand Down Expand Up @@ -224,6 +223,7 @@ module.exports = function(botkit, config) {
} else {
if (!bot.rtm)
throw new Error('Cannot use the RTM API to send messages.');
slack_message.id= message.id || bot.msgcount;

try {
bot.rtm.send(JSON.stringify(slack_message), function(err) {
Expand Down

0 comments on commit 11bc225

Please sign in to comment.