fixed bugs in reimagine if prompt missing. removed unused prompt code

This commit is contained in:
phixxy 2024-01-21 13:57:21 -08:00
parent ef5b841b86
commit 22354ec275

View file

@ -329,21 +329,18 @@ class StableDiffusion(commands.Cog):
try: try:
if ctx.message.attachments: if ctx.message.attachments:
file_url = ctx.message.attachments[0].url file_url = ctx.message.attachments[0].url
prompt = ctx.message.content.split(" ", maxsplit=1)[1]
elif ctx.message.content.startswith("!reimagine "): elif ctx.message.content.startswith("!reimagine "):
file_url = ctx.message.content.split(" ", maxsplit=2)[1] file_url = ctx.message.content.split(" ", maxsplit=2)[1]
try:
prompt = ctx.message.content.split(" ", maxsplit=2)[2]
except:
prompt = ""
else: else:
print("No image linked or attached.") await ctx.send("No image linked or attached.")
return return
except Exception as error: except Exception as error:
await self.handle_error(error) await self.handle_error(error)
print("Couldn't find image.") print("Couldn't find image.")
return return
prompt = self.get_prompt_from_ctx(ctx) prompt = self.get_prompt_from_ctx(ctx)
if not prompt:
prompt = ""
key_value_pairs = self.get_kv_from_ctx(ctx) key_value_pairs = self.get_kv_from_ctx(ctx)
try: try:
async with self.bot.http_session.get(file_url) as response: async with self.bot.http_session.get(file_url) as response: