mathew-kurian / FacebookMessengerBot.js

:mailbox: Simple, light-weight Facebook Messenger Bot API for Node with ES6 support (via. Promises)
https://developers.facebook.com/docs/messenger-platform
117 stars 24 forks source link

Add sender options to bot api, fixes issue #14 #20

Closed Kilian closed 7 years ago

Kilian commented 7 years ago

This adds 4 api's to the Bot class:

The latter three all use the senderAction, which handles the communication. There is a start and stop function for convenience, and a setTyping function with a boolean for conditionally showing it. They are documented in the README.md

I use it like this, which makes it seem like the bot is actually typing:

  await bot.startTyping(sender.id);
  await Bot.wait(500 + (Math.random() * 1000));
  await bot.send(sender.id, reply);
mathew-kurian commented 7 years ago

Thanks for PR. But something failing here?

Kilian commented 7 years ago

I see. I would prefer to keep the variable name as "sender_action", so we keep in tandem with Facebook's naming. Are you alright with adding an eslint disable-line, or do you want me to change it to senderAction?

Kilian commented 7 years ago

I have renamed the variable to senderAction.

mathew-kurian commented 7 years ago

I do appreciate that @Kilian