Amazebot / bbot

An adaptable conversation engine for building bespoke bots.
MIT License
55 stars 2 forks source link

Refactor callback usage #82

Closed timkinnane closed 6 years ago

timkinnane commented 6 years ago

In early days, bBot adopted the Hubot pattern of using callbacks for things like completing a response, but since most of these methods return promises, the callback was optional and more intended just to give a familiar interface for those not au fait with async programming.

It's become more trouble than it's worth, specifically to allow optional arguments before a callback, it complicates the method signature and handling, when only one argument is given you need to determine was it the option or the callback.

Would be better to just encourage consistent usage of promise returns and await/async instead of also maintaining the callback pattern. Need to review this in one refactor, along with docs and tests.