Files
discord_bot/test2.py
2022-06-29 23:17:16 +03:00

18 lines
457 B
Python

import json
def write_json(guild: int, param_name: str, param: str or int):
with open('prefix.json', 'r', 'utf-8') as _f:
try:
_json = json.load(_f)
except json.decoder.JSONDecodeError:
_json = {}
_json.update({f'{guild}': {}})
print(_json)
_guild = _json[f'{guild}']
print(_guild)
_guild.update({f'{param_name}': f'{param}'})
print(_json)
write_json(929446191270330452, 'test1', '34')