cleaned up some variable names

This commit is contained in:
phixxy 2024-01-30 01:52:20 -08:00
parent 3854a9b03c
commit 8f0014bb17

View file

@ -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):