0
votes

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)
1
Could you share your code ?MrSpaar
Hi, I edited my post with the code I used for the description in the embed.Senpai

1 Answers

0
votes

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))