diff options
Diffstat (limited to 'data/rbot/plugins/reaction.rb')
-rw-r--r-- | data/rbot/plugins/reaction.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/data/rbot/plugins/reaction.rb b/data/rbot/plugins/reaction.rb index 4f757ddd..8892cf7a 100644 --- a/data/rbot/plugins/reaction.rb +++ b/data/rbot/plugins/reaction.rb @@ -220,7 +220,10 @@ class ReactionPlugin < Plugin }.compact return if candidates.empty? match, wanted = candidates.sort { |m1, m2| - m1.first[0].length <=> m2.first[0].length + # Order by longest matching text first, + # and by number of captures second + longer = m1.first[0].length <=> m2.first[0].length + longer == 0 ? m1.first.length <=> m2.first.length : longer }.last matched = match[0] before = match.pre_match.strip |