From c849dd2bf6dec84810ddb2b81f71921e78214cbf Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Sat, 16 Jul 2016 15:26:30 -0500 Subject: [PATCH] Added saveContent method --- cogs/utils/config.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cogs/utils/config.py b/cogs/utils/config.py index c91a6b4..a784050 100644 --- a/cogs/utils/config.py +++ b/cogs/utils/config.py @@ -1,6 +1,7 @@ import yaml import pymysql.cursors import asyncio +import json loop = asyncio.get_event_loop() @@ -39,3 +40,9 @@ def getCursor(): def closeConnection(): connection.commit() connection.close() + +def saveContent(key: str, content): + with open("/home/phxntx5/public_html/Bonfire/config.json", "r+") as f: + jfile = json.load(f) + if key in content: + jfile[key]= content