1.0.0 • Published 5 years ago

@fappurbate/cb-enhancements v1.0.0

Weekly downloads
-
License
WTFPL
Repository
github
Last release
5 years ago

@fappurbate/cb-enhancements

Some enhancements to the Chaturbate apps & bots API.

Usage

Simply import it in the beginning of your Chaturbate app or bot.

require('@fappurbate/cb-enhancements');

Documentation

cb.onMessage()

Before

Originally, only the last call to cb.onMessage counts. All previous handlers are thrown away. So, in the following example Notice: 1 will never be shown.

cb.onMessage(msg => cb.sendNotice(1));
cb.onMessage(msg => cb.sendNotice(2));
After

Now all handlers will be called, with the msg object passed sequentially from the first handler to the last one. If some handler returns a falsy value, it is ignored. So, in the following example both Notice: 1 and Notice: 2 will be shown, and "12" will be appended to the message.

cb.onMessage(msg => {
  cb.sendNotice(1);
  msg.m += 1;
  return msg;
});
cb.onMessage(msg => {
  cb.sendNotice(2);
  msg.m += 2;
  return msg;
});