我整个上午都在。我目前正在开发一个可有效创建角色的函数,只需单击一下响应,但现在它已经抛出相同的错误已有一生。
这是我的代码:
client.on('message', async message => {
let AdminRole = message.member.roles.cache.find(role => role.name === "Server Moderators")
let RulerRole = message.member.roles.cache.find(role => role.name === "The Supreme Boomers")
let RatRole = message.member.roles.cache.find(role => role.name === "Rat Majesty Robin")
if (message.member.roles.cache.has(AdminRole)) {
} else if (message.member.roles.cache.has(RulerRole)) {
} else if (message.member.roles.cache.has(RatRole)) {
}
if (message.content === `${prefix}createBumpRole`) {
message.channel.send("Do you want to create a role for bumping? Click on either the check mark or cross depending on your choice.")
message.react("✅") | message.react("❌")
}
const filter = (reaction, user) => {
return ['✅', '❌'].includes(reaction.emoji.name) && user.id === message.author.id;
};
message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '✅') {
message.guild.cache.roles.create({
data: {
name: 'bumping ping',
color: 'BLUE',
},
reason: 'We needed a role for people who regularly bump the server.',
})
} else if (reaction.emoji.name === '❌') {
message.reply('Thank you for the response. You have exited this program.');
}
})
});