From 512517f76ef5f7ef8552053750a46a031aa75d87 Mon Sep 17 00:00:00 2001 From: profitroll Date: Tue, 17 Jan 2023 15:21:26 +0100 Subject: [PATCH] Fixed imports --- yusarin.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/yusarin.py b/yusarin.py index b6ff69f..b16a12f 100644 --- a/yusarin.py +++ b/yusarin.py @@ -13,7 +13,7 @@ pid = getpid() version = 1.8 if loadJson("config.json")["owner"] == "SET-OWNER-ID" or loadJson("config.json")["bot_token"] == "SET-BOT-TOKEN": - print(f"Bot is not correctly configured.\nMake sure you've set up owner id and bot token in {path}/config.json\nLearn more here: https://git.end-play.xyz/profitroll/YusarinBot") + print(f"Bot is not correctly configured.\nMake sure you've set up owner id and bot token in 'config.json'\nLearn more here: https://git.end-play.xyz/profitroll/YusarinBot") exit() if loadJson("config.json")["check_for_updates"]: @@ -42,21 +42,17 @@ async def on_ready(): @client.event async def on_guild_join(guild): - global path - - makedirs(f"{path}/guilds/{str(guild.id)}", exist_ok=True) - makedirs(f"{path}/guilds/{str(guild.id)}/channels", exist_ok=True) - saveJson({}, f"{path}/guilds/{str(guild.id)}/config.json") + makedirs(f"guilds/{str(guild.id)}", exist_ok=True) + makedirs(f"guilds/{str(guild.id)}/channels", exist_ok=True) + saveJson({}, f"guilds/{str(guild.id)}/config.json") appendLog(f"Joined guild '{guild}' with id {str(guild.id)}") @client.event async def on_guild_remove(guild): - - global path try: - rmtree(f"{path}/guilds/{str(guild.id)}") + rmtree(f"guilds/{str(guild.id)}") except: pass @@ -127,7 +123,7 @@ async def help(ctx: ApplicationContext): locale = client.create_group("locale", "Commands related to bot's locale") valid_locales = [] -files_locales = listdir(f"{path}/locale/") +files_locales = listdir(f"locale/") for entry in files_locales: valid_locales.append(".".join(entry.split(".")[:-1])) @@ -135,13 +131,13 @@ for entry in files_locales: async def locale_set(ctx: ApplicationContext, language: Option(str, "One of the languages in list", choices=valid_locales)): # type: ignore config = loadJson("config.json") if ctx.guild is not None: - if language+".json" in listdir(f"{path}/locale/"): + if language+".json" in listdir(f"locale/"): guildConfSet(ctx.guild, "locale", language) appendLog(f"Server's locale is now set to {language}", ctx.guild) await ctx.respond(embed=makeEmbed(title=getMsg("set_locale_title", ctx.guild), description=getMsg("set_locale_description", ctx.guild).format(getMsg("locale_name", ctx.guild)), color=strToColor(config["color_ok"]))) else: valid_locales = [] - files_locales = listdir(f"{path}/locale/") + files_locales = listdir(f"locale/") for entry in files_locales: valid_locales.append(entry.split(".")[:-1]) await ctx.respond(embed=makeEmbed(title=getMsg("error_locale_title", ctx.guild), description=getMsg("error_locale_description", ctx.guild).format(", ".join(valid_locales)), color=strToColor(config["color_error"]))) @@ -166,7 +162,7 @@ async def locale_reset(ctx: ApplicationContext): # type: ignore channel = client.create_group("channel", "Commands related to parent voice channel") @channel.command(name="set", description="Select the voice channel that will be parent to private ones") -async def channel_set(ctx: ApplicationContext, channel: Option(discord.VoiceChannel, "Parent Voice Channel")): # type: ignore +async def channel_set(ctx: ApplicationContext, channel: Option(VoiceChannel, "Parent Voice Channel")): # type: ignore config = loadJson("config.json") if ctx.guild is not None: guildConfSet(ctx.guild, "channel", channel.id) @@ -193,7 +189,7 @@ async def channel_reset(ctx: ApplicationContext): # type: ignore category = client.create_group("category", "Commands related to parent channels category") @category.command(name="set", description="Select the voice channel that will be parent to private ones") -async def category_set(ctx: ApplicationContext, category: Option(discord.CategoryChannel, "Parent Channel Category")): # type: ignore +async def category_set(ctx: ApplicationContext, category: Option(CategoryChannel, "Parent Channel Category")): # type: ignore config = loadJson("config.json") if ctx.guild is not None: guildConfSet(ctx.guild, "category", category.id)