有没有一种使不和谐嵌入更好的方法?

时间:2019-08-05 01:20:56

标签: javascript bots embed discord discord.js

我正在开发自己的Discord机器人,我的问题是嵌入,node.js中是否有一些技巧或模块可以帮助我美化那些机器人?

我唯一需要尝试的是默认嵌入,公平的说,我不太喜欢

else if (message.content.startsWith(`${ prefix }queue`)) {
    if (!serverQueue){
        message.channel.send('Nothing playing');
        message.channel.send({
            embed: {
                color: 13702935,
                description: `**Song Queue**
                ${serverQueue.songs.map(song => `**-**${song.title}`).join("\n")}
                **Now Playing:** ${serverQueue.songs[0].title}
                `
            }
        }
    }
}

2 个答案:

答案 0 :(得分:1)

var embed = new Discord.RichEmbed()
.setAuthor('Song Queue',message.guild.iconURL) //<- optional
.addField(`Song Queue`,`${serverQueue.songs.map(song => `**-**${song.title}`).join("\n")}`,true)
.addField(`Now Playing`,`${serverQueue.songs[0].title}`,true)
.setTimestamp()
.setColor("#hexcode")
.setFooter(`${message.author.tag}`, message.author.avatarURL)
message.channel.sendEmbed(embed);

答案 1 :(得分:0)

我建议您看看this page 它显示了更多可能的字段

您还可以查看我的机器人的嵌入之一。

const exampleEmbed = new Discord.RichEmbed()
    .setColor('#0099ff')
    .setTitle('Add Jerseyetr')
    .setURL('xxxxxx')
    .setAuthor('Midnight Bot', 'image.png', 'https://xxxxxxxx.com')
    .setDescription('')
    .setThumbnail(imageFromGoogle.png')
    .addField('How to Gain Access to the Server', '1. Go to the Rules Section and read the rules \n2. Add XXXX on Steam. Link above \n3. Download and install our mods. Check the #information Channel for info')
    .addBlankField()
    .addField('Mods download:', 'https://xxxxxxxxx', true)
    .addField('how to install mods', 'https://xxxxxxx', true)
    .addField('Vote for our Server', 'https://xxxxx', true)
    .setImage('')
    .setTimestamp()
    .setFooter('Updated 5/20', 'https://imageFromGoogle.com');

channel.send(exampleEmbed);