Eli
Eli

Reputation: 39

Discord.js - Embed links? V12

I'm new to discord.js and js overall so I'm curious on how my links don't appear embedded?

I want them to appear like this https://prnt.sc/twcqv5 instead of just my embed with out that showing

Input: https://prnt.sc/twcvzo

Output: https://prnt.sc/twcw23

exports.run = async(client, message, args) => {
    if (!message.member.hasPermission(['ADMINISTRATOR'])) return message.reply("You cant use that")
    else {
        await message.delete()
        let text = message.content.substring(6);
        if (!text) return message.reply(`Please provide **text** after the command to embed`)

        let embed = new Discord.MessageEmbed()
            .setColor('BLACK')
            .setAuthor('Syprant Gaming')
            .setDescription(`${text}`)

        try {
            message.channel.send(embed);
        } catch (err) {
            console.warn(err);
        }
    }
}

Upvotes: 1

Views: 2173

Answers (1)

Dorian349
Dorian349

Reputation: 1589

You can't put link preview with links inside an embed.

If you want to have URL redirection and stuff like that, you can only use these methods:

You can first of all format links in a description with [Link name](https://your-url.com).

For the example you sent, you need to check these methods:

.setAuthor(name, iconURL, url) -> Put your link instead of 'url'. Author line is at the top of the embed.

.setURL(url) -> Put your link instead of 'url'.

Upvotes: 2

Related Questions