Discord.js必须将消息发送到Embed(因此它可能是指定的参数

时间:2018-04-17 12:09:54

标签: javascript bots discord.js

有必要将消息发送到Embed(因此它可以是指定的参数(颜色,作者,标题,描述,addField,内容消息) 示例:https://embedbuilder.nadekobot.me/

const arg = message.content.slice().trim().split(/ +/g);

let name = arg[1];
if (!name) return message.channel.send(channelEmbed);
let anonce = args.slice(1).join();
if(!anonce) return message.channel.send(anonceEmbed);

let anoncechannel = message.guild.channels.find(`name`, name);

anoncechannel.sendEmbed(anonce)

1 个答案:

答案 0 :(得分:0)

看看RichEmbeds 您可以构建一个新的RichEmbed,然后将其发送到您想要的频道。您可以设置每个值,标题,描述,颜色,页脚..
例如:

const exampleEmbed = new Discord.RichEmbed()
    .setColor('#0099ff')
    .setTitle('Some title')
    .setURL('https://discord.js.org/')
    .setAuthor('Some name', 'https://i.imgur.com/wSTFkRM.png', 'https://discord.js.org')
    .setDescription('Some description here')
    .setThumbnail('https://i.imgur.com/wSTFkRM.png')
    .addField('Regular field title', 'Some value here')
    .addField('Inline field title', 'Some value here', true)
    .addField('Inline field title', 'Some value here', true)
    .addField('Inline field title', 'Some value here', true)
    .setImage('https://i.imgur.com/wSTFkRM.png')
    .setTimestamp()
    .setFooter('Some footer text here', 'https://i.imgur.com/wSTFkRM.png');

message.channel.send({ embed: exampleEmbed });

来源:discordjs.guide

这将是输出:
enter image description here