refractor lib code
This commit is contained in:
@@ -2,10 +2,6 @@ import json
|
||||
from os import walk
|
||||
|
||||
|
||||
async def set_prefix(guildid: int, prefix: str) -> None:
|
||||
await write_json(guildid, "prefix", prefix)
|
||||
|
||||
|
||||
async def list_files(fold: str = 'audio'):
|
||||
fl = []
|
||||
for filenames in walk(fold):
|
||||
@@ -17,7 +13,13 @@ async def list_files(fold: str = 'audio'):
|
||||
return fl[2]
|
||||
|
||||
|
||||
async def read_json(guild: int, param: str):
|
||||
async def read_json(guild: int, _param: str) -> int or str:
|
||||
"""
|
||||
Reads Json file to determite config strings
|
||||
:param guild: ID of Guild
|
||||
:param _param: Parameter in json file
|
||||
:return: value of parameter
|
||||
"""
|
||||
with open('prefix.json', 'r', encoding='utf-8') as fp: # Open the JSON
|
||||
try:
|
||||
_json = json.load(fp) # Load the custom prefixes
|
||||
@@ -27,9 +29,9 @@ async def read_json(guild: int, param: str):
|
||||
try:
|
||||
guild_conf = _json[f"{guild}"]
|
||||
try:
|
||||
parameter = guild_conf[f"{param}"]
|
||||
parameter = guild_conf[f"{_param}"]
|
||||
except:
|
||||
pass
|
||||
parameter = None
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user