Ad

How To Hide Links In Discord.js

- 1 answer

I've got this code

client.on('message', message => {
    if (message.content === `L!succ`) {
    // message goes below!
        message.channel.send('https://cdn.discordapp.com/attachments/525096492470370314/653855352877481984/8742_Succ.gif');
        }
});

It's good and all but I wanna hide the url I've tried the following

client.on('message', message => {
    // If the message is '!rip'
    if (message.content === '!rip') {
    // Create the attachment using MessageAttachment
    const attachment = new MessageAttachment('https://i.imgur.com/w3duR07.png');
    // Send the attachment in the message channel
    message.channel.send(attachment);
    }
});

(so trying to attach it) So I want to make the link disappear and just make it become just the gif itself hopefully someone can help me with this?

Ad

Answer

WITH Attachment as file

client.on('message', message => {
    // If the message is '!rip'
    if (message.content === '!rip') {
        // Create the attachment using Attachment
        const attachment = new Attachment('https://i.imgur.com/w3duR07.png');
        // Send the attachment in the message channel
        message.channel.send(attachment);
    }
});

WITH Embeded IMAGE

client.on('message', message => {
    if (message.content === '!rip') {
    let embed = new Discord.RichEmbed()
        embed.setImage('https://i.imgur.com/w3duR07.png')
    message.channel.send(embed);
    }
});
Ad
source: stackoverflow.com
Ad