From d4e01d4b585651a13a72fe77bee806009be97d68 Mon Sep 17 00:00:00 2001 From: phixxy Date: Wed, 27 Dec 2023 22:05:14 -0800 Subject: [PATCH] Fixed bug in upload_ai_images --- sparkytron3000.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sparkytron3000.py b/sparkytron3000.py index 5b9dd96..fad81ce 100644 --- a/sparkytron3000.py +++ b/sparkytron3000.py @@ -90,7 +90,7 @@ async def upload_ftp_ai_images(filename, prompt): server_folder = os.getenv('ftp_ai_images') new_filename = str(time.time_ns()) + ".png" await upload_sftp(filename, server_folder, new_filename) - print("Uploaded", new_file_name) + print("Uploaded", new_filename) with open(html_file, 'r') as f: html_data = f.read() html_insert = html_insert.replace("", new_filename) @@ -1468,13 +1468,15 @@ async def imagine(ctx): channel_vars = await get_channel_config(ctx.channel.id) - if channel_vars["ftp_enabled"]: - await upload_ftp_ai_images(my_filename, prompt) - with open(my_filename, "rb") as fh: f = discord.File(fh, filename=my_filename) - + await ctx.send(file=f) + + if channel_vars["ftp_enabled"]: + await upload_ftp_ai_images(my_filename, prompt) + + @bot.command( description="Describe",