Fixed bug in upload_ai_images

This commit is contained in:
phixxy 2023-12-27 22:05:14 -08:00
parent 6a6863406d
commit d4e01d4b58

View file

@ -90,7 +90,7 @@ async def upload_ftp_ai_images(filename, prompt):
server_folder = os.getenv('ftp_ai_images') server_folder = os.getenv('ftp_ai_images')
new_filename = str(time.time_ns()) + ".png" new_filename = str(time.time_ns()) + ".png"
await upload_sftp(filename, server_folder, new_filename) await upload_sftp(filename, server_folder, new_filename)
print("Uploaded", new_file_name) print("Uploaded", new_filename)
with open(html_file, 'r') as f: with open(html_file, 'r') as f:
html_data = f.read() html_data = f.read()
html_insert = html_insert.replace("<!--filename-->", new_filename) html_insert = html_insert.replace("<!--filename-->", new_filename)
@ -1468,13 +1468,15 @@ async def imagine(ctx):
channel_vars = await get_channel_config(ctx.channel.id) 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: with open(my_filename, "rb") as fh:
f = discord.File(fh, filename=my_filename) f = discord.File(fh, filename=my_filename)
await ctx.send(file=f) await ctx.send(file=f)
if channel_vars["ftp_enabled"]:
await upload_ftp_ai_images(my_filename, prompt)
@bot.command( @bot.command(
description="Describe", description="Describe",