From: Thorsten Date: Wed, 13 Dec 2023 16:44:08 +0000 (+0100) Subject: fix stupid mistakes X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=a83c037cb76aa7ca152076ff60d71e25c8a28b3e;p=urlbot-v3.git fix stupid mistakes --- 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)