Skip to content
Snippets Groups Projects
Commit 92c632d8 authored by Bruce Cowan's avatar Bruce Cowan :airplane:
Browse files

Special case cpp

parent 50defa3f
No related branches found
No related tags found
Loading
Pipeline #1910 passed
# 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 # 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 # it under the terms of the GNU General Public License as published by
...@@ -45,6 +45,8 @@ class Karma(BotPlugin): ...@@ -45,6 +45,8 @@ class Karma(BotPlugin):
"""Adds karma""" """Adds karma"""
if message.frm == self.bot_identifier: if message.frm == self.bot_identifier:
return return
if 'c++' in message.body.casefold():
return "**Info**: Ignoring C++"
return self._change_karma(match.group(1), 1, message) return self._change_karma(match.group(1), 1, message)
......
# 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 # 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 # it under the terms of the GNU General Public License as published by
...@@ -35,3 +35,9 @@ def test_top_bottom(testbot): ...@@ -35,3 +35,9 @@ def test_top_bottom(testbot):
testbot.assertCommand("!karma top 1", "high: 2") testbot.assertCommand("!karma top 1", "high: 2")
testbot.assertCommand("!karma top 2", "high: 2, medium: 1") 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()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment