From 0a3ed438af25c02d4e55b86e0230a9c4dfc68ad2 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Sat, 27 Feb 2021 20:11:24 +0100 Subject: [PATCH] Try to fill out entire dictionary contents Covers edge cases where the state is improperly setup. --- LogBot/logbot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/LogBot/logbot.py b/LogBot/logbot.py index 958889a..467370e 100644 --- a/LogBot/logbot.py +++ b/LogBot/logbot.py @@ -138,9 +138,11 @@ class Logbot(Bot): if room not in self.db.keys(): self.db[room] = {} + if "messages" not in self.db[room]: self.db[room]["messages"] = {} + if "title" not in self.db[room]: self.db[room]["title"] = room - self.log.info(f"Added to the database: { room }") + self.log.info(f"Added to the database: { room }") if not os.path.exists(room_path): os.mkdir(room_path)