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?
Connecting existing Slack RTM bots to new Microsoft bot framework back end after upgrade
Cancel a prompt or dialog after certain time - Bot Framework
How do I add a deep link to an app from my messenger bot?
How can I use the same bot on multiple facebook pages using bot framework
Why have I no callback query when i use URL in inline_keyboard?
Bot service with OAuth endpoint
What is the right way to measure time between bot's message and user's answer in the bot framework?
Telegram bot issue
Design custom entities for api.ai
How can I make a program to operate another program? [closed]
How to get the Skype username using skype calling feature
How to Resolve this issue “Could not find a stock quote for GOOGL or some other company names”
Open messenger chatbot webview extension in Chrome
How to pass control from one LUIS method to another?
How to transfer conversation from Bot to human agents?
How to speak skype user with the bot using skype calling feature?