-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Question: How to trigger the convo.ask
callback only if the user mentions the bot
#436
Comments
@ljfranklin try convo.source_messsage. It should have an event property which will be direct_message, direct_mention, ect. Edit: I misread your question. This won't help you. This would actually be decently hard I think because by default if you are in a conversation all messages are sent to the conversation once its started. I guess you could parse the @symbol ? Edit2: Actually I think you won't be able to do this. By default the mentions are stripped out of the message and used to trigger the specific event, but the event won't be added to the response object because its already in a conversation. Check out SlackBot.js:
|
I think is not possible so the ask callback will be triggered always BUT... you can check the response in the callback function and if this response don't start with @bot use convo.silentRepeat(), you know?
|
Closed as answered |
@EloyRedondo thanks! Checking to see if the text contains |
By default, the
ask
callback is triggered the next time the target user enters any message. I'd like to only trigger this callback if the target user's reply mentions the bot.Desired behavior:
At a glance, I didn't see any properties in the
response
orconvo
that indicated whether the response included a mention or not. Thanks!The text was updated successfully, but these errors were encountered: