open() raised an uncaught FileNotFoundError at class-definition time,
which is never caught by Worker.callback and crashed the whole worker
process on any deployment that hadn't manually placed the file (e.g.
munin, a fresh clone). Also ship mampfdb.json itself so the food-choice
feature works instead of silently falling back to an empty dict.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
--- /dev/null
+{
+ "frühstück": [
+ "Brot",
+ "Brötchen",
+ "Pizza von gestern",
+ "Kuchen",
+ "Müsli",
+ "Haferschleim",
+ "kommerzielles Zuckerweizengericht",
+ "Pfannkuchen"
+ ],
+ "mittagessen": [
+ "Stück Fleisch",
+ "Stück Fisch",
+ "Bratwurst",
+ "Nudelauflauf",
+ "Kartoffelauflauf",
+ "Eintopf",
+ "Suppe",
+ "Pasta mit Pesto",
+ "Lasagne",
+ "Käsekeks",
+ "Brot",
+ "Curry",
+ "Pommes",
+ "Backkartoffeln",
+ "Currywurst",
+ "Salat",
+ "Pfannkuchen",
+ "Flammkuchen"
+ ],
+ "abendessen": [
+ "Brot",
+ "Brötchen",
+ "Sandwich",
+ "Suppe",
+ "Pfannkuchen"
+ ],
+ "nachtisch": [
+ "Eis",
+ "Kuchen",
+ "Quark",
+ "Pudding",
+ "Mousse",
+ "Obst",
+ "Brokkoli",
+ "Milchreis",
+ "Griesbrei",
+ "Keks",
+ "Crème Brûlée",
+ "Jokurt",
+ "Crêpe",
+ "Tiramisu",
+ "Mus",
+ "Waffeln"
+ ]
+}
"Can't tell right now.", "I need more information.", "Sorry, did you say something?"), 1)
)
- with open("mampfdb.json", "r") as fd:
- try:
+ try:
+ with open("mampfdb.json", "r") as fd:
mampfdb = json.load(fd)
- except:
- mampfdb = {}
+ except (OSError, json.JSONDecodeError):
+ mampfdb = {}
def is_mampf(self, choice: str):
logger.debug(f"is {choice} mampf?")