From: Matthias Hecker Date: Sat, 11 Apr 2020 19:25:03 +0000 (+0200) Subject: plugin(points): strip/ignore some terms closes #34 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=ac8529c8370bd6dbcb0947bc14e1cc2117826a29;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git plugin(points): strip/ignore some terms closes #34 - strip color/bold codes in terms - ignore terms with ++/-- in them --- 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!"