bots


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?

Related Links

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?

Categories

HOME
entity-framework
mod-rewrite
macos-sierra
azure-functions
verification
ios-simulator
bing-search
biztalk-2010
azure-data-lake
implicit-conversion
onvif
cocotb
mutation-testing
solution
graphdb
jquery-file-upload
mpu6050
jpa-2.0
mahout-recommender
android-5.1.1-lollipop
gravity
pickle
checkout
nose
xsl-fo
multi-upload
mime-types
channel
ini
chronicle-queue
exchange-server-2010
restier
password-generator
prompt
fstar
tf-idf
marquee
pyspark-sql
splunk-query
tightvnc
objectmapper
premake
sca
markov-chains
autoencoder
grails-2.5
cups
redgate
jade4j
ms-solver-foundation
task-parallel-library
fiware-wirecloud
latexml
bit-shift
realstudio
autorelease
sonarqube5.2
sony-future-lab-n
nusoap
exc-bad-access
mongodb-aggregation
bbc-micro
uibinder
utf-16
myfaces
android-mapview
largenumber
openshift-cartridge
apache-commons-digester
sqlbase
knife
featuretoggle
ngcordova
clarion
fuseesb
scala-swing
mxe
sql-processor
iodocs
cout
global-scope
quantify
full-text-indexing
csslint
code-complexity
forio-contour
wso2bam
progress-db
iirf
codahale-metrics
html-frames
tfs-sdk
android-authenticator
jquery-cycle
xalan
clearinterval
arrow
java.lang.class
kobold2d
liveconnect
wcf-callbacks
motodev-studio
getopts
database-deadlocks
azure-acs
css-friendly
dip
eaccelerator
mongrel
chunking
multiple-users
pinax
sscli
autobench
acceleration
community-server

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App