From 0c678d89886cdc62d485ef25d7c08598e47ee5a5 Mon Sep 17 00:00:00 2001 From: Lili Date: Mon, 16 Jan 2023 13:30:15 +0100 Subject: [PATCH] add a safeguard for empty list categories redeems remove warnings in readme about it as well --- README.md | 2 +- tlapbot/owncast_helpers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7f9bc64..2046814 100644 --- a/README.md +++ b/README.md @@ -274,4 +274,4 @@ Each dictionary entry is a redeem, and the dictionary keys are strings that deci - `"price"` value should be an integer that decides how many points the redeem will cost. - `"type"` value should be either `"list"`, `"counter"` or `"note"`. This decided the redeem's type, and whether it will show up as a counter at the top of the dashboard or as an entry in the "recent redeems" chart. - `"info"` value should be a string that describes what the command does. It's optional, but I recommend writing one for all `"list"` and `"note"` redeems (so that chatters know that they should write a note). -- `"category"` is an optional list of strings, the categories the redeem is in. If a category from the list is in `ACTIVE_CATEGORIES` from `config.py`, then the redeem will be active. Otherwise it will not appear at all. **If you want a redeem to be always active, leave this field out.** \ No newline at end of file +- `"category"` is an optional list of strings, the categories the redeem is in. If a category from the list is in `ACTIVE_CATEGORIES` from `config.py`, then the redeem will be active. \ No newline at end of file diff --git a/tlapbot/owncast_helpers.py b/tlapbot/owncast_helpers.py index 9d7ef7d..3b91544 100644 --- a/tlapbot/owncast_helpers.py +++ b/tlapbot/owncast_helpers.py @@ -236,7 +236,7 @@ def remove_emoji(message): def is_redeem_active(redeem, active_categories): - if "category" in redeem[1]: + if "category" in redeem[1] and redeem[1]["category"]: for category in redeem[1]["category"]: if category in active_categories: return True