Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with greeting [BOTKIT] #59

Merged
merged 11 commits into from
Dec 3, 2019
Merged
5 changes: 4 additions & 1 deletion features/greeting/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ const replies = require('./replies.js')
const randomArrayItem = array => array[Math.floor(Math.random() * array.length)]

module.exports = (controller) => {
const matchKeys = queries.join('|')
const regexp = new RegExp(`\\b(${matchKeys})\\b`, 'i')

controller.hears(
queries,
regexp,
['message', 'direct_message'],
async (bot, message) => {
await bot.reply(message, { text: randomArrayItem(replies) })
Expand Down
3 changes: 2 additions & 1 deletion features/greeting/queries.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
module.exports = [
'Hello',
'Good morning',
'Good afternoon',
'G\'day',
'\^Hi\$',
'Hi',
'Morning',
'Hey',
]
Loading