Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit bd4f3c0

Browse files
author
Christian Nunciato
committed
Adjust the thank-you script to use word boundaries
At our company, we have an employee whose name is a substring of our Hubot instance's name. This fixes that.
1 parent 325bdc7 commit bd4f3c0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/scripts/polite.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ farewellResponses = [
4040
youTalkinToMe = (msg, robot) ->
4141
input = msg.message.text.toLowerCase()
4242
name = robot.name.toLowerCase()
43-
input.indexOf(name) != -1
43+
input.match(new RegExp('\\b' + name + '\\b', 'i')) !== null
4444

4545
module.exports = (robot) ->
4646
robot.hear /\b(thanks|thank you|cheers|nice one)\b/i, (msg) ->

0 commit comments

Comments
 (0)