From 8f0014bb1739d8e45ca6e7d061339db84aa7bf5b Mon Sep 17 00:00:00 2001 From: phixxy Date: Tue, 30 Jan 2024 01:52:20 -0800 Subject: [PATCH] cleaned up some variable names --- extensions/chatgpt.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/extensions/chatgpt.py b/extensions/chatgpt.py index 8f3da86..e96783b 100644 --- a/extensions/chatgpt.py +++ b/extensions/chatgpt.py @@ -262,15 +262,15 @@ class ChatGPT(commands.Cog): async def dalle3hd(self, ctx): if ctx.author.get_role(self.premium_role): prompt = ctx.message.content.split(" ", maxsplit=1)[1] - img_url = await self.get_dalle(prompt, model="dall-e-3", quality="hd", size="1792x1024") + image_url = await self.get_dalle(prompt, model="dall-e-3", quality="hd", size="1792x1024") my_filename = str(time.time_ns()) + ".png" - filepath = f"{self.data_dir}dalle/{my_filename}" - await self.download_image(img_url, filepath) - with open(filepath, "rb") as fh: - f = discord.File(fh, filename=filepath) + image_filepath = f"{self.data_dir}dalle/{my_filename}" + await self.download_image(image_url, image_filepath) + with open(image_filepath, "rb") as fh: + f = discord.File(fh, filename=image_filepath) log_data = f'Author: {ctx.author.name}, Prompt: {prompt}, Filename: {my_filename}\n' - with open(f"{self.data_dir}logs/dalle3.log", 'a') as log_file: - log_file.writelines(log_data) + with open(f"{self.data_dir}logs/dalle3.log", 'a') as log_filepath: + log_filepath.writelines(log_data) await ctx.send(f'Generated by: {ctx.author.name}\nPrompt: {prompt}', file=f) else: await ctx.send("Sorry you must be a premium member to use this command. (!donate)") @@ -324,7 +324,7 @@ class ChatGPT(commands.Cog): with open(reminders_path,"w") as file_obj: file_obj.write("{}") prompt = ctx.message.content.split(" ", maxsplit=1)[1] - data = self.read_db(reminders_path) + reminder_data = self.read_db(reminders_path) current_time = int(time.time_ns()) user_id = ctx.author.id @@ -341,10 +341,10 @@ class ChatGPT(commands.Cog): target_time = current_time + int(duration_ns) #CREATE FILEDUMP - data[target_time] = {"user_id":user_id,"response":response} + reminder_data[target_time] = {"user_id":user_id,"response":response} self.bot.logger.info(f"Reminding user {ctx.author.id} in {duration_s} seconds || Target time (ns): {target_time}") - self.save_to_db(reminders_path,data) + self.save_to_db(reminders_path,reminder_data) @tasks.loop(seconds=60) # THIS ONE NEEDS TO POP AND THEN CALL THE REMIND FUNC async def remind_me_loop(self):