Amazebot / bbot

An adaptable conversation engine for building bespoke bots.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refactor callback usage

timkinnane opened this issue · comments

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.