summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2020-08-19 14:57:27 +0200
committermakefu <github@syntax-fehler.de>2020-08-19 14:57:27 +0200
commit177b966030f619e134a1020d018ea06b7164e9ce (patch)
tree09f86efaf7a3a089771e3df57049191a23408f54
parent45f1a7670a57e87a323fbf3f82dcc5e15ed1cde6 (diff)
fix crash with empty arguments for functions which require argument
-rw-r--r--kalauerbot/bot.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/kalauerbot/bot.py b/kalauerbot/bot.py
index 427bee6..912584a 100644
--- a/kalauerbot/bot.py
+++ b/kalauerbot/bot.py
@@ -72,7 +72,7 @@ class Kalauerbot(MatrixBot):
""")
try: command,args= msg.split(" ",1)
- except: command = msg
+ except: command,args = msg,""
if command in ["!add", "!activate", "!reactivate"]:
name = args.strip()
@@ -136,13 +136,15 @@ class Kalauerbot(MatrixBot):
self.save_db()
elif command == "!demand":
name = args.strip()
- if name in self.active_db():
+ if not name:
+ say("When demanding a player, you must define who you actually want")
+ elif name in self.active_db():
say(f"The previous kalauer könig demands user {name} to be the next kalauer könig. The rules of the Kalauer are divine and shall be respected.")
db["__chosen__"] = name
elif name in db:
say(f"{name} is currently not active, cannot be chosen")
else:
- say(f"{name} name does not exist in the database, add the user before demanding a kalauer from him")
+ say(f"the name '{name}' does not exist in the database, add the user before demanding a kalauer from him")
self.save_db()
elif command == "!list":
txt = "Kalauer roster:\n\n"