How to hide the original link in discord.py

Viewed 8036

I'm making a basic discord bot, and one of the things it will be doing is sending messages consisting of website links.

Not sure if this is even possible, but is there any way to hide to original link (https://...and so on), and just show the link preview/embed?

While we're on the topic, is there any way I can modify how said embed looks? Like, can I change the text on it (while keeping the underlying link the same, of course)?

Basically, hide the https://stackoverflow.com/, and say, change the text in the embed to read "Click Me!", while still linking to stackoverflow

2 Answers

You can make your own embed and have a hyperlink that goes to the url. You can make hyperlinks with [text](url) so for example [Click Me!](https://stackoverflow.com).

Note: this can only be done inside an embed's description or field value or by a webhook

You can do this with embeds, this partially recreates the embed you showed.

@client.command()
async def sendembed(ctx):
    e = discord.Embed(title="Stack Overflow - Where Developers Learn, Share, & Build Careers",
                      url="https://stackoverflow.com",
                      description="Stack Overflow | The World’s Largest Online Community for Developers")
    e.set_thumbnail(url="https://i.imgur.com/ddx8Bpg.png")
    await ctx.send(embed=e)
Related