slack-bot-api
slack-bot-api copied to clipboard
.fail example given in readme does not get called
From the readme:
bot.postMessageToUser('user1', 'hi').fail(function(data) { //data = { ok: false, error: 'user_not_found' } })
if you change user1 to a user that exists, the message does get sent
if user1 does not exist, the anonymous function provided to fail never gets called, the failure simply happens silently.
not sure if this is a change on Slack's end that has broken this, or if it's an issue with the slackbots
library, but something likely needs to be updated either way.
I should clarify that yes, I threw a console.log in that function and it doesn't execute, I didn't just copy/paste it verbatim into my code :-)
Thanks for the issue. I will think how to fix it, but you can use callback instead of promises.
bot.postMessageToUser('user1', 'hi', function(data) {/* ... */});