Error on draw failure

Kaveen Kumarasinghe 2 years ago
parent 9690f8b875
commit 7327982f3c

@ -44,12 +44,24 @@ class DrawDallEService(commands.Cog, name="DrawDallEService"):
):
await asyncio.sleep(0)
# send the prompt to the model
file, image_urls = await self.model.send_image_request(
prompt, vary=vary if not draw_from_optimizer else None
)
from_context = isinstance(ctx, discord.ApplicationContext)
try:
file, image_urls = await self.model.send_image_request(
prompt, vary=vary if not draw_from_optimizer else None
)
except ValueError as e:
(
await ctx.channel.send(
f"Error: {e}. Please try again with a different prompt."
)
if not from_context
else await ctx.respond(f"Error: {e}. Please try again with a different prompt.")
)
return
# Start building an embed to send to the user with the results of the image generation
embed = discord.Embed(
title="Image Generation Results"

Loading…
Cancel
Save