xBytez / slackbotapi

node.js Slack RTM API module
GNU Lesser General Public License v3.0
135 stars 40 forks source link

presence_change events being blocked #40

Closed magroski closed 9 years ago

magroski commented 9 years ago

I was testing multiple events using your code and I noticed that this block of code

} else if (data.type === 'presence_change') {
   // update slackData presence when user becomes active/inactive
   for (var i in self.slackData.users) {
      if (self.slackData.users[i].id === data.user) {
         self.slackData.users[i].presence = data.presence;
         break;
      }
   }
}

is blocking the bot from processing presence_change events.

Adding cb(null, messageData); after the for loop easily solve this problem.

https://github.com/xBytez/slackbotapi/blob/master/lib/rtm.js#L240

franciskim commented 9 years ago

looking back that seems like the sensible thing to do, thanks for bringing that up! @magroski

magroski commented 9 years ago

Don't forget to push the changes to npm :)

xBytez commented 9 years ago

I wont! I'm still working on a bit of documentation and I'll then update npm with the new version!