aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2021-09-09 10:02:23 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2021-09-09 10:02:23 +0200
commit0abab7461ce76248a176ae5996e436224a4fcc02 (patch)
tree61e4ab2cf278763e0a3865e84638234130ee8922
parentd04115253559a675b164a209ca1fdd0353136156 (diff)
downloadgeldschieberbot-0abab7461ce76248a176ae5996e436224a4fcc02.tar.gz
geldschieberbot-0abab7461ce76248a176ae5996e436224a4fcc02.zip
add thanks command easteregg
-rw-r--r--geldschieberbot.py11
-rwxr-xr-xtest.py12
2 files changed, 23 insertions, 0 deletions
diff --git a/geldschieberbot.py b/geldschieberbot.py
index 9c622bd..3ad9960 100644
--- a/geldschieberbot.py
+++ b/geldschieberbot.py
@@ -847,6 +847,17 @@ def cancel(sender, args, msg):
cmds["cancel"] = cancel
+def thanks(sender, args, msg):
+ sender_name = num2name.get(sender, sender)
+ msg = f'You are welcome. It is a pleasure to work with you, {sender_name}.'
+ nick = None if len(args) == 1 else args[1]
+ if nick:
+ msg = f"{msg}\nBut don't call me {nick}."
+
+ return msg, None
+
+cmds["thanks"] = thanks
+
def main():
if len(sys.argv) > 1 and sys.argv[1] in ["-d", "--dry-run"]:
diff --git a/test.py b/test.py
index 0120c89..79098f2 100755
--- a/test.py
+++ b/test.py
@@ -1120,6 +1120,18 @@ fiat:
\tBalance: -3.00"""
self.assertEqual(res.stdout, msg)
+class TestThanks(unittest.TestCase):
+ def test_thanks(self):
+ res = run_bot(self, num[alice], "!thanks")
+ self.assertEqual(
+ res.stdout,
+ f"You are welcome. It is a pleasure to work with you, {alice}.")
+
+ def test_thanks_nick(self):
+ res = run_bot(self, num[alice], "!thanks pussy")
+ self.assertEqual(
+ res.stdout,
+ f"You are welcome. It is a pleasure to work with you, {alice}.\nBut don't call me pussy.")
if __name__ == '__main__':
unittest.main()