From 92c632d8eef46b6f109431366b84626f7f6edfde Mon Sep 17 00:00:00 2001
From: Bruce Cowan <bruce@bcowan.me.uk>
Date: Thu, 23 Aug 2018 12:53:52 +0100
Subject: [PATCH] Special case cpp

---
 karma.py      | 4 +++-
 test_karma.py | 8 +++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/karma.py b/karma.py
index 60f5b59..9ec84d2 100644
--- a/karma.py
+++ b/karma.py
@@ -1,4 +1,4 @@
-# Copyright © 2016, 2018 Bruce Cowan <bruce@bcowan.eu>
+# Copyright © 2016, 2018 Bruce Cowan <bruce@bcowan.me.uk>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -45,6 +45,8 @@ class Karma(BotPlugin):
         """Adds karma"""
         if message.frm == self.bot_identifier:
             return
+        if 'c++' in message.body.casefold():
+            return "**Info**: Ignoring C++"
 
         return self._change_karma(match.group(1), 1, message)
 
diff --git a/test_karma.py b/test_karma.py
index c9f5655..e96c1ce 100644
--- a/test_karma.py
+++ b/test_karma.py
@@ -1,4 +1,4 @@
-# Copyright © 2018 Bruce Cowan <bruce@bcowan.eu>
+# Copyright © 2018 Bruce Cowan <bruce@bcowan.me.uk>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -35,3 +35,9 @@ def test_top_bottom(testbot):
 
     testbot.assertCommand("!karma top 1", "high: 2")
     testbot.assertCommand("!karma top 2", "high: 2, medium: 1")
+
+def test_cpp(testbot):
+    testbot.push_message("c++ is horrible")
+    assert "Info: Ignoring C++" in testbot.pop_message()
+    testbot.push_message("C++ is not horrible")
+    assert "Info: Ignoring C++" in testbot.pop_message()
-- 
GitLab