refractor lib code

This commit is contained in:
2022-08-22 01:17:27 +03:00
parent ea3e9dd105
commit e1b782c2cb
5 changed files with 34 additions and 47 deletions

View File

@@ -1,11 +1,5 @@
import json
from os import walk, path
def check_json():
if not path.isfile('prefix.json'):
with open('prefix.json', 'w+', encoding='utf-8') as f:
f.write("")
from os import walk
async def set_prefix(guildid: int, prefix: str) -> None:
@@ -25,7 +19,6 @@ async def list_files(fold: str = 'audio'):
async def read_json(guild: int, param: str):
with open('prefix.json', 'r', encoding='utf-8') as fp: # Open the JSON
parameter = None
try:
_json = json.load(fp) # Load the custom prefixes
except TypeError:
@@ -39,6 +32,7 @@ async def read_json(guild: int, param: str):
pass
except:
pass
return parameter
@@ -66,7 +60,6 @@ async def determine_prefix(bot, msg):
:return: prefix for server, default is $
"""
with open('prefix.json', 'r', encoding='utf-8') as fp: # Open the JSON
parameter: str
try:
from json import load
_json = load(fp) # Load the custom prefixes