This commit is contained in:
bot
2024-03-25 10:14:57 +03:00
parent c3140403b5
commit 78be10a88b
4 changed files with 12 additions and 6 deletions

View File

@@ -9,7 +9,7 @@ from os import getenv
from disnake.ext import commands
async def read_json(guild: int, _param: str):
def read_json(guild: int, _param: str):
"""
Reads Json file to determite config strings
:param guild: ID of Guild
@@ -35,6 +35,7 @@ async def read_json(guild: int, _param: str):
async def write_json(guild: int, param_name: str, param: str or int):
print(type(param))
with open(getenv('CONF_FILE'), encoding='utf-8') as f:
try:
_json = load(f)
@@ -45,7 +46,8 @@ async def write_json(guild: int, param_name: str, param: str or int):
except KeyError:
_json.update({f'{guild}': {}})
_guild = _json[f'{guild}']
_guild.update({f'{param_name}': f'{param}'})
_guild.update({f'{param_name}': param})
_json.update({f'{guild}': _guild})
with open(getenv('CONF_FILE'), 'w', encoding='utf-8') as f:
dump(_json, f, indent=4)