【问题标题】:Discord Bot embed msgDiscord Bot 嵌入消息
【发布时间】:2021-08-12 04:38:22
【问题描述】:

我需要在embed msg右侧添加bot的图片。

if (message.includes('help')) {

msg.channel.send({
  embed: {
    title: "xxxxxx",
    color: 3447003,
    description:"Enter **agjgj** to know \n\n Enter **jfjk** for \n\n Enter **ufuy** to get"
  }
});

}

还有如何在这段代码中标记用户。

【问题讨论】:

    标签: javascript node.js discord.js bots


    【解决方案1】:

    您可以在嵌入后的下一条消息中标记用户。 msg.channel.send(message.author.toString())

    并在嵌入中添加缩略图(右侧图像):

    embed: {
        title: "xxxxxx",
        color: 3447003,
        description:"asdasd",
        thumbnail: {
            url: "https://asd.com/asd.png"
        } 
      }
    

    使用服务器上托管的文件作为缩略图:

    const file = new Discord.MessageAttachment('./asd.png');
    message.channel.send({files: [file], 
        embed: {
            title: "xxxxxx",
            color: 3447003,
            description:"asdasd",
            thumbnail: {
                url: 'attachment://asd.png',
            }
        }
    });
    

    【讨论】:

    • 除了添加网址之外,还有其他方法,例如添加图像和共享位置。
    • @AlexyPThomas 我认为可以通过将文件附加到嵌入然后将其用作缩略图(或图像)的 URL。您可以在嵌入页面link 上查看如何操作的信息
    • 我正在检查并这样做。但它没有得到反映。不管怎样,谢谢。我正在使用网址。
    • 我刚刚尝试过,它有效,您可以查看我编辑的答案。但我仍然认为使用外部图像托管更好(即 imgur)。
    猜你喜欢
    • 2021-12-21
    • 2021-06-16
    • 2021-07-23
    • 2021-12-12
    • 2023-03-07
    • 2019-07-04
    • 1970-01-01
    • 2018-12-04
    • 2021-03-27
    相关资源
    最近更新 更多