diff options
-rw-r--r-- | kalauerbot/bot.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kalauerbot/bot.py b/kalauerbot/bot.py index de95ade..448e3d0 100644 --- a/kalauerbot/bot.py +++ b/kalauerbot/bot.py @@ -154,11 +154,12 @@ class Kalauerbot(MatrixBot): 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": - all_weight = sum([db[a]["weight"] for a in db if a != "__chosen__"]) + all_weight = sum([db[a]["weight"] for a in db if a != "__chosen__" and db[a]["active"]] ) txt = "Kalauer roster:\n\n" for name,entry in db.items(): if name == '__chosen__': continue - txt += f"* {name} - {entry['weight']} weight ({round(entry['weight']/all_weight * 100,1)}%) - {entry['total']} total {'(active)' if entry['active'] else '(inactive)'}\n" + prob = round(entry['weight']/all_weight * 100,1) + txt += f"* {name} - {entry['weight']} weight ({prob if entry['active'] else 0}%) - {entry['total']} total {'(active)' if entry['active'] else '(inactive)'}\n" say(txt) elif command == "!kill": name = args.strip() |