fix: Validate retrieved image URL and improve error handling

This commit is contained in:
Slipstream 2025-05-19 19:19:43 -06:00
parent a4843dbfc2
commit fb2e360d8c
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -24,9 +24,13 @@ class TetoImageCog(commands.Cog):
description=f"Website: {self.footer_url}",
color=discord.Color.red()
)
embed.set_image(url=image_url)
embed.set_footer(text="Random Teto Image Website", icon_url=None)
await ctx.send(embed=embed)
print(f"Image URL: {image_url}") # Debugging line
if image_url.startswith("http") or image_url.startswith("https"):
embed.set_image(url=image_url)
embed.set_footer(text="Random Teto Image Website", icon_url=None)
await ctx.send(embed=embed)
else:
await ctx.send("The retrieved URL was not valid.")
else:
await ctx.send("Could not get the image URL from the redirect.")
else: