Flx some bugs
This commit is contained in:
14
function.py
14
function.py
@@ -12,7 +12,9 @@ from io import BytesIO
|
||||
from pymongo import MongoClient
|
||||
from typing import Optional
|
||||
|
||||
if not os.path.exists("./settings.json"):
|
||||
root_dir = os.path.dirname(__file__)
|
||||
|
||||
if not os.path.exists(root_dir + "/settings.json"):
|
||||
print("Error: Settings file not set!")
|
||||
exit()
|
||||
|
||||
@@ -79,23 +81,23 @@ def update_settings(guildid:int, data, mode="Set"):
|
||||
return
|
||||
|
||||
def langs_setup():
|
||||
for language in os.listdir('./langs'):
|
||||
for language in os.listdir(root_dir + './langs'):
|
||||
if language.endswith('.json'):
|
||||
with open(f'./langs/{language}', encoding="utf8") as json_file:
|
||||
with open(f'{root_dir}/langs/{language}', encoding="utf8") as json_file:
|
||||
lang = json.load(json_file)
|
||||
|
||||
langs[language[:-5]] = lang
|
||||
|
||||
for language in os.listdir('./local_langs'):
|
||||
for language in os.listdir(root_dir + './local_langs'):
|
||||
if language.endswith('.json'):
|
||||
with open(f'./local_langs/{language}', encoding="utf8") as json_file:
|
||||
with open(f'{root_dir}/local_langs/{language}', encoding="utf8") as json_file:
|
||||
lang = json.load(json_file)
|
||||
|
||||
local_langs[language[:-5]] = lang
|
||||
return
|
||||
|
||||
def settings_setup():
|
||||
with open('./settings.json', encoding="utf8") as json_file:
|
||||
with open(root_dir + '/settings.json', encoding="utf8") as json_file:
|
||||
rawSettings = json.load(json_file)
|
||||
|
||||
global nodes, embed_color, bot_access_user, emoji_source_raw, bot_prefix, max_queue, cooldowns_settings, aliases_settings
|
||||
|
||||
6
main.py
6
main.py
@@ -19,8 +19,8 @@ class Translator(discord.app_commands.Translator):
|
||||
print("Unload Translator")
|
||||
|
||||
async def translate(self, string: discord.app_commands.locale_str, locale: discord.Locale, context: discord.app_commands.TranslationContext):
|
||||
if str(locale) in local_langs:
|
||||
return local_langs[str(locale)].get(string.message, None)
|
||||
if str(locale) in function.local_langs:
|
||||
return function.local_langs[str(locale)].get(string.message, None)
|
||||
return None
|
||||
|
||||
class Vocard(commands.Bot):
|
||||
@@ -36,7 +36,7 @@ class Vocard(commands.Bot):
|
||||
|
||||
async def setup_hook(self):
|
||||
function.langs_setup()
|
||||
for module in os.listdir('./cogs'):
|
||||
for module in os.listdir(function.root_dir + '/cogs'):
|
||||
if module.endswith('.py'):
|
||||
try:
|
||||
await self.load_extension(f"cogs.{module[:-3]}")
|
||||
|
||||
@@ -3,7 +3,7 @@ from io import BytesIO
|
||||
|
||||
root_dir = __file__.replace("update.py", "")
|
||||
filename = root_dir + "Vocard.zip"
|
||||
__version__ = "v2.5.3"
|
||||
__version__ = "v2.5.4"
|
||||
|
||||
def checkVersion(withMsg = False):
|
||||
resp = requests.get("https://api.github.com/repos/ChocoMeow/Vocard/releases/latest")
|
||||
@@ -12,7 +12,7 @@ def checkVersion(withMsg = False):
|
||||
if version == __version__:
|
||||
print(f"Your bot is up-to-date! - {version}")
|
||||
else:
|
||||
print(f"Your bot is not up-to-date! This latest version is {version} and you are currently running version {__version__}\n. Run `python update --start` to update your bot!")
|
||||
print(f"Your bot is not up-to-date! This latest version is {version} and you are currently running version {__version__}\n. Run `python update.py --start` to update your bot!")
|
||||
return version
|
||||
|
||||
def downloadFile(version:str = None):
|
||||
|
||||
Reference in New Issue
Block a user