Botkit: Allow bot to listen to any user in a channel after sending a question

Created on 1 Jun 2016  路  8Comments  路  Source: howdyai/botkit

I have written a lunch function that picks up a place for lunch to #general channel every 1pm using bot.say and cron.
Is it possible (or something like built-in "ask-in-channel") that the bot can listen to any user in a channel after sending a question?

Slack-related enhancement stale

Most helpful comment

+1
Some way to disable or unbind specific controller.hears calls, or a "public" conversation type that anyone in a channel can respond to, would be appreciated.

All 8 comments

+1
Alternatively is it possible to use controller.hears to listen for an ambient message temporarily?

馃憤

+1
Some way to disable or unbind specific controller.hears calls, or a "public" conversation type that anyone in a channel can respond to, would be appreciated.

Any update on this?

There is not currently a way to do this, but it's a good idea. We'll consider ways to add this.

Has anyone done it with a workaround?

Can you tell me more about the specific use case you imagine? Just a convo that anyone can respond to?

We run a bot at our studio that determines which task an employee might need to do on a certain day. For example we have a cron job that executes a function every day at 9am that asks all the users in a channel if the dishwasher was loaded the previous evening/who did it. Anyone needs to be able to answer the question as the employee that performed the task the previous evening might not be in that day.

My implementation at present means I just have a 'global' controller.hears([patterns.yes] and controller.hears([patterns.no], each of which execute a function that checks the 'question state' to try and determine what the user is replying to. I use regular bot.say() functions to ask a question and update the 'question state' accordingly. It's not very pretty, but luckily in our case these channel wide questions only require yes or no answers at present.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

direct_message: one to one chat
direct_mention: Message at the beginning @Bot user
mention: @Bot User message except at the beginning

controller.hears('hello', ['direct_message', 'direct_mention', 'mention'], (bot, message) => {
    bot.reply(message,'hello I am your bot.');
});
Was this page helpful?
0 / 5 - 0 ratings