slackbotapi icon indicating copy to clipboard operation
slackbotapi copied to clipboard

Constructor does asynchronous tasks

Open fontanierh opened this issue 9 years ago • 1 comments

The constructor performs asynchronous request to the Slack rtm.start method. The getChannel method of this module relies on the information gathered from this request and may fail when called right after construction.

fontanierh avatar Jul 12 '16 23:07 fontanierh

What is the desired behavior here? Asynchronous behavior in constructor is undesired in my opinion. Perhaps there needs to be a .init() or .connect() method that covers the asynchronous behavior of the constructor? This is breaking change though.

The methods relying on the data from the constructor could also throw an error when the data is still undefined. This could be retried at some point in the future.

SimonJang avatar Oct 02 '19 18:10 SimonJang