How to make Hubot know he/she is receiving the message in a private chat?
I am creating a Hubot script to do some stuffs. However due to some circumstances, we need to make sure certain commands only works when sent via PM (private message) instead of channels (e.g. telling the bot to save some password). As a workaround, I am currently using this checker function: is_private = (res) -> res.message.room == res.message.user.name We are currently using this with Slack, but need to make the script also works with other adapters as well since we're going to release it as open source project. Is this method reliable enough? Is there any built-in methods to check this?
The Adapter interface is mum on private messages (Campfire, the first adapter, has absolutely no support for PMs). I think your method will work fine for most adapters, but cross-adapter PM behavior is an ongoing issue. Maybe, sometime, I'll get to work on the Adapter interface, but most of my effort is currently focused on the message processing flow. I'd recommend going with it and keeping an eye out for issues after you release.
In your case, consider use hubot-auth to control permissions for your users https://www.npmjs.com/package/hubot-auth or How to setup Hubot basic permissions?
Can I install multiple bots on a single Facebook fanpage
How to get name, timezone, gender of your bot user in Messenger 1.4 API?
Bot becomes slow over time in loop
How to add discord bots the fastest way?
Microsoft Bot Framework - Proactive message, suspend current dialog
PromptDialog.Choice - Invalid Type Exception
Unknown CTA IDs in Facebook Analytics for Apps
Microsoft Bot Skype Group Chat
BotFramework sorry the service was upgraded and we need to start over
Best way to find moving function for a bot
api.ai domain intent query response
How to define string as luis entity
Luis V2 Remove action parameter/prompt
Telegram Bot PHP keyboard doesn't works
How can I use PromptDialog.Choice while allowing the user to type the options without worrying about accented letters?
Messenger Bot Webview not closing on IOS