Is there a way to make my bot embed images if user input an image URL or attached image on description?
I made an embed command where my bot will ask what’s the title of the embed, description of the embed and what channel the user wants the embed to be sent. It works well, but whenever someone input an image URL link on the description my bot just shows the link not the image.
I tried using embed.set_image
it was working
but whenever a user sends a none link description I get an error
Invalid Form Body In embed.image.url: Not a well formed URL.
And also when the user replied an attached image the bot will send the embed, but will completely leave the description blank.
Code that I used for the description.
desc= [] await ctx.channel.send('Description that you want to be embed') msg = await self.client.wait_for('message', check=check(ctx.author)) desc.append(msg.content) desc1 = ''.join(desc) embed = discord.Embed(color=0xD5A6BD, description=str(desc1), timestamp=ctx.message.created_at) await submit_chan.send(embed=embed)
Your error seems to indicate an invalid URL. Here’s a way to fetch an image url from input/attachment.
@commands.command() async def em(self, ctx, url=None): if not url: url = ctx.message.attachments[0].url print(url) await ctx.send(embed=Embed().set_image(url=url))