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

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

Categories

HOME
visual-studio
flask
magento2
knockout.js
mc
list
cucumber
clearcase
concurrency
tcsh
stacktrace.js
risk-management
autocomplete
twitter-fabric
tcp
gallery
google-sheets-query
biztalk-2010
hyperledger
implicit-conversion
visualforce
linker
save
wine
colors
erd
createjs
sslhandshakeexception
asciimath
dashdb
connection-refused
cell
tortoisemerge
strophe.js
ruby-daemons
points
ibm-connections
microprocessors
audit
publishing
series
actframework
nppexec
variable-variables
aurelia-http-client
linq.js
netapp
yoast
zend-form
xcode8.2
liteide
adblock
cyanogenmod
karabiner
webvtt
popen
dtd
swiperefreshlayout
maatwebsite-excel
metabase
nclam
nvda
seccomp
perforce-integrate
bbc-micro
apache-pig-grunt
noclassdeffounderror
jemdoc
mnesia
gridbaglayout
i2b2
teensy
deeplink
variable-length-array
lowercase
apache-commons-digester
dsa
enaml
actionpack
gflags
uno
thoughtworks-go
nesper
category-theory
accessory
two.js
cidr
mod-perl
armv6
application-blocks
sql-view
mp4parser
ui-design
significant-digits
cyrillic
android-dialog
chronometer
border-box
zotonic
monocross
autosize
fitch-proofs
sigar
datacontracts
server-variables
fork-join
django-pagination
solandra
uninstaller
eai

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App