summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorMatthias Hecker <mail@apoc.cc>2020-04-11 21:25:03 +0200
committerMatthias Hecker <mail@apoc.cc>2020-04-11 21:25:03 +0200
commitac8529c8370bd6dbcb0947bc14e1cc2117826a29 (patch)
tree6c6cf1b6e7d2d62334df36239ee498ce1be76466 /data
parentfe217ba8960032cef8a61dafb59d1468360e8e5f (diff)
plugin(points): strip/ignore some terms closes #34
- strip color/bold codes in terms - ignore terms with ++/-- in them
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/points.rb4
1 files changed, 3 insertions, 1 deletions
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!"