【问题标题】:Is there a way of making discord embeds better?有没有办法让不和谐嵌入更好?
【发布时间】:2019-12-12 13:05:36
【问题描述】:
我正在开发自己的不和谐机器人,我的问题是嵌入,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}
`
}
}
}
}
【问题讨论】:
标签:
javascript
bots
embed
discord
discord.js
【解决方案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);
【解决方案2】:
我建议看看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);