From a83c037cb76aa7ca152076ff60d71e25c8a28b3e Mon Sep 17 00:00:00 2001 From: Thorsten Date: Wed, 13 Dec 2023 17:44:08 +0100 Subject: [PATCH] fix stupid mistakes --- distbot/plugins/didyouknow.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/distbot/plugins/didyouknow.py b/distbot/plugins/didyouknow.py index a9fdbfa..696948f 100644 --- a/distbot/plugins/didyouknow.py +++ b/distbot/plugins/didyouknow.py @@ -17,7 +17,7 @@ DB = [ class DidYouKnow(Worker): binding_keys = [ "#.wusstet.ihr.#", - "Hi.#" + "hi.#", ] description = "smart bot" usage = "wusstest ihr schon." @@ -57,12 +57,13 @@ class DidYouKnow(Worker): def insert_fact(self, msg): - with open(self.dynamic_db, "w") as fd: + with open(self.dynamic_db, "r+") as fd: try: db = json.load(fd) except Exception as e: db = {"quotes": []} db["quotes"].append(msg["body"]) + fd.seek(0) json.dump(db, fd, indent=2) -- 2.39.2