diff options
author | makefu <github@syntax-fehler.de> | 2020-08-29 12:02:33 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2020-08-29 12:02:33 +0200 |
commit | 08d98aa4e6291824f66a55f259c8ffe4eb829126 (patch) | |
tree | 06b17dfdb0c357f53c6a00393b20727951b0a6c9 /kalauerbot | |
parent | ee694e9e7e65877403d1df1f2e47118c388bd634 (diff) |
take activity status into consideration for list
Diffstat (limited to 'kalauerbot')
-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() |