3 回答
TA贡献1836条经验 获得超4个赞
这应该工作
if (message.content === 'zservers'){
let serverlist = ''
bot.guilds.cache.forEach((guild) => {
serverlist = serverlist.concat(" - " + guild.name + ": ID: " + guild.id + "\n")
})
const embed = new MessageEmbed()
.setColor("RANDOM")
.setTitle("Servers that have Naruse Jun Bot", '')
.setDescription(serverlist)
message.channel.send({embed});
}
TA贡献2003条经验 获得超2个赞
制作一个通用字符串,然后将公会附加到该字符串。
if (message.content === 'zservers'){
let guilds = '';
bot.guilds.cache.forEach((guild) => {
guilds = guilds.concat(guild).concat("\n"); // concatenate the guild and add a new line in the end.
})
const serverlist = new Discord.MessageEmbed()
.setTitle(`𝘚𝘦𝘳𝘷𝘦𝘳𝘴 𝘭𝘰𝘷𝘦𝘭𝘭 𝘪𝘴 𝘪𝘯.`)
.addField(guilds) // use the general 'guilds' string.
.setFooter(`Invite lovell <$`)
message.channel.send(serverlist)
}
TA贡献2012条经验 获得超12个赞
工作?
编辑:更新!现在应该工作了。
if (message.content === 'zservers'){
let guilds = bot.guilds.cache.array().join('\n')
const serverlist = new Discord.MessageEmbed()
.setTitle(`𝘚𝘦𝘳𝘷𝘦𝘳𝘴 𝘭𝘰𝘷𝘦𝘭𝘭 𝘪𝘴 𝘪𝘯.`)
.setDescription(guilds)
.setFooter(`Invite lovell <$`)
message.channel.send(serverlist)
}
添加回答
举报