繁体   English   中英

如何在discord.js中隐藏链接

[英]how to hide links in discord.js

我有这个代码

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');
        }
});

很好,但我想隐藏我尝试过的网址

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

(所以试图附加它)所以我想让链接消失,让它变成 gif 本身,希望有人能帮我解决这个问题?

现在是这样的:

client.on("message", msg => {
    let embed = new Discord.MessageEmbed();
    attachment.setImage("Your URL");
    msg.reply(embed);
});

RichEmbed 不再可用

将附件作为文件

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

带有嵌入图像

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM