fix: Validate retrieved image URL and improve error handling
This commit is contained in:
parent
a4843dbfc2
commit
fb2e360d8c
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user