Try to fill out entire dictionary contents

Covers edge cases where the state is improperly setup.
This commit is contained in:
Luke Murphy 2021-02-27 20:11:24 +01:00
parent d5cb732aaf
commit 0a3ed438af
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

View File

@ -138,9 +138,11 @@ class Logbot(Bot):
if room not in self.db.keys(): if room not in self.db.keys():
self.db[room] = {} self.db[room] = {}
if "messages" not in self.db[room]:
self.db[room]["messages"] = {} self.db[room]["messages"] = {}
if "title" not in self.db[room]:
self.db[room]["title"] = 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): if not os.path.exists(room_path):
os.mkdir(room_path) os.mkdir(room_path)