Hi! Your library is really awesome. It has been helpful in letting me creating a Slackbot very quickly.
I found a few bugs in the PM functionality and I thought I would pass my fixes along for your perusal.
getIM function:
The self variable was never initialized. This caused the function to crash. (duh)
The second search loop in the getIM function (lines 244 - 247) used the value of the getUser function without checking to make sure getUser didn't return null. If the term is not a user, the function would just crash before it even got to the third search loop that checks for channel ID.
sendPM function:
The sendPM originally would just crash if getIM returned null.
I changed the behavior so that if getIM returns null (no private IM channel is found), the function will attempt to create a new private IM channel using reqAPI. It then adds that IM channel to the list of known IM channels, and sends the message to the newly created channel.
I tested this behavior on the bot that I have been working on that needs to send lots of PM's, and it seems to work like a charm :-)
Hi! Your library is really awesome. It has been helpful in letting me creating a Slackbot very quickly.
I found a few bugs in the PM functionality and I thought I would pass my fixes along for your perusal.
getIM function:
self
variable was never initialized. This caused the function to crash. (duh)sendPM function:
I tested this behavior on the bot that I have been working on that needs to send lots of PM's, and it seems to work like a charm :-)