From ac8529c8370bd6dbcb0947bc14e1cc2117826a29 Mon Sep 17 00:00:00 2001 From: Matthias Hecker Date: Sat, 11 Apr 2020 21:25:03 +0200 Subject: plugin(points): strip/ignore some terms closes #34 - strip color/bold codes in terms - ignore terms with ++/-- in them --- data/rbot/plugins/points.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'data') diff --git a/data/rbot/plugins/points.rb b/data/rbot/plugins/points.rb index 58f24501..0209fabe 100644 --- a/data/rbot/plugins/points.rb +++ b/data/rbot/plugins/points.rb @@ -109,7 +109,9 @@ class PointsPlugin < Plugin end ac.each do |k, v| - next if v == 0 + next if v == 0 or /--|\+\+/.match(k) + # strip invisible formatting characters like bold or color codes + k = k.gsub(FormattingRx, '') @registry[k] += (v > 0 ? 1 : -1) m.reply @bot.lang.get("thanks") if k == @bot.nick && v > 0 m.reply "#{k} now has #{@registry[k]} points!" -- cgit v1.2.3