From d4fb9d9bb34eddde13fe0b074b48a84fd4d69d7f Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Tue, 4 Jul 2023 23:17:43 +0530 Subject: [PATCH] Add missing `json.dump()` function trigger after editing setting value --- framework/isobot/settings.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/isobot/settings.py b/framework/isobot/settings.py index 6172d27a..5237b503 100644 --- a/framework/isobot/settings.py +++ b/framework/isobot/settings.py @@ -40,7 +40,9 @@ def edit_setting(self, user_id: int, setting: str, value) -> Literal[0]: """Modifies the value of a user setting.""" with open("config/settings.json", 'r', encoding="utf-8") as f: db = json.load(f) db[str(user_id)][setting] = value + with open("config/settings.json", 'w+', encoding="utf-8") as f: json.dump(db, f, indent=4) return 0 + def reset(self, user_id: int): """Completely resets the specified user's configuration.""" with open("config/settings.json", 'r', encoding="utf-8") as f: db = json.load(f) @@ -50,4 +52,3 @@ def reset(self, user_id: int): db[str(user_id)] = template with open("config/settings.json", 'w+', encoding="utf-8") as f: json.dump(db, f, indent=4) return 0 - \ No newline at end of file