From 31962d33c61251098e4c75baefd9bb8d0ab84740 Mon Sep 17 00:00:00 2001 From: phixxy Date: Sat, 20 Jan 2024 00:34:54 -0800 Subject: [PATCH] changing db folder to data --- extensions/stable_diffusion.py | 16 ++++++++-------- sparkytron3000.py | 8 ++------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/extensions/stable_diffusion.py b/extensions/stable_diffusion.py index 81a7043..b18d657 100644 --- a/extensions/stable_diffusion.py +++ b/extensions/stable_diffusion.py @@ -16,7 +16,7 @@ class StableDiffusion(commands.Cog): self.bot = bot self.stable_diffusion_url = os.getenv("stablediffusion_url") # Change this to stable_diffusion_url self.working_dir = "tmp/stable_diffusion/" - self.db_dir = "db/stable_diffusion/" + self.data_dir = "data/stable_diffusion/" self.folder_setup() def folder_setup(self): @@ -25,8 +25,8 @@ class StableDiffusion(commands.Cog): os.mkdir(self.working_dir) os.mkdir(f"{self.working_dir}sfw") os.mkdir(f"{self.working_dir}nsfw") - if not os.path.exists(self.db_dir): - os.mkdir(self.db_dir) + if not os.path.exists(self.data_dir): + os.mkdir(self.data_dir) except: print("StableDiffusion failed to make directories") @@ -52,7 +52,7 @@ class StableDiffusion(commands.Cog): print(error) current_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) log_line = current_time + ': ' + str(error) + '\n' - file_name = self.db_dir + "error_log.log" + file_name = self.data_dir + "error_log.log" with open(file_name, 'a') as f: f.write(log_line) return error @@ -211,11 +211,11 @@ class StableDiffusion(commands.Cog): if prompt == None: prompt = await self.generate_prompt() try: - neg_prompt_file = f"{self.db_dir}negative_prompt.txt" + neg_prompt_file = f"{self.data_dir}negative_prompt.txt" with open(neg_prompt_file, 'r') as f: negative_prompt = f.readline() except: - neg_prompt_file = f"{self.db_dir}negative_prompt.txt" + neg_prompt_file = f"{self.data_dir}negative_prompt.txt" with open(neg_prompt_file, 'w') as f: f.writelines("") negative_prompt = "" @@ -264,7 +264,7 @@ class StableDiffusion(commands.Cog): f = discord.File(fh, filename=my_filename) log_data = f'Author: {ctx.author.name}, Prompt: {prompt}, Filename: {my_filename}\n' - with open(f"{self.db_dir}stable_diffusion.log", 'a') as log_file: + with open(f"{self.data_dir}stable_diffusion.log", 'a') as log_file: log_file.writelines(log_data) await ctx.send(f'Generated by: {ctx.author.name}\nPrompt: {prompt}', file=f) @@ -395,7 +395,7 @@ class StableDiffusion(commands.Cog): message = ' '.join(args) if not message: message = "easynegative, badhandv4, verybadimagenegative_v1.3" - neg_prompt_file = f"{self.db_dir}negative_prompt.txt" + neg_prompt_file = f"{self.data_dir}negative_prompt.txt" with open(neg_prompt_file, 'w') as f: f.writelines(message) await ctx.send("Changed negative prompt to " + message) diff --git a/sparkytron3000.py b/sparkytron3000.py index c5094f5..5f75bea 100644 --- a/sparkytron3000.py +++ b/sparkytron3000.py @@ -273,14 +273,10 @@ async def on_ready(): folders_made = await folder_setup() await delete_all_files("tmp/", folders_made) - # Import plugins from plugins folder - for plugin_file in os.listdir('plugins/'): - if plugin_file != '__init__.py' and plugin_file[-3:] == '.py': - await bot.load_extension(f'plugins.{plugin_file[:-3]}') - + # Import plugins from extensions folder for plugin_file in os.listdir('extensions/'): if plugin_file != '__init__.py' and plugin_file[-3:] == '.py': - await bot.load_extension(f'plugins.{plugin_file[:-3]}') + await bot.load_extension(f'extensions.{plugin_file[:-3]}') print('We have logged in as {0.user}'.format(bot))