FIX: Wrong discobot tutorial started for certain locales.

If a locale has triggers that start with the same word, our regexp will
always end up matching the first trigger. For example,

`start tutorial` and `start tutorial advanced`

To support the change, we have to make the match on triggers more
restrictive. `@discobot quote here` will no longer work like `@discobot
quote`.
This commit is contained in:
Guo Xiang Tan
2019-08-08 10:47:39 +08:00
parent b574276e6e
commit 636b6c3a5a
2 changed files with 34 additions and 10 deletions

View File

@ -227,7 +227,7 @@ module DiscourseNarrativeBot
def match_trigger?(trigger)
discobot_username = self.discobot_user.username
regexp = Regexp.new("<a class=\"mention\".*>@#{discobot_username}</a> #{trigger}", 'i')
regexp = Regexp.new("<a class=\"mention\".*>@#{discobot_username}</a> #{trigger}</p>", 'i')
match = @post.cooked.match(regexp)
if @is_pm_to_bot