晚上好,我有一个主要问题,我的机器人一直在自我重新发布。任何帮助将不胜感激。
module.exports = {
name: 'reactionrole',
description: "Sets up a reaction role message!",
async execute(message, args, Discord, client) {
const channel = 'channel ID';
const TankRole = message.guild.roles.cache.find(role => role.name === "Tank Role");
const DpsRole = message.guild.roles.cache.find(role => role.name === "Dps Role");
const HealRole = message.guild.roles.cache.find(role => role.name === "Heal Role");
const TankEmoji = '?️';
const DpsEmoji = '?';
const HealEmoji = '?';
let embed = new Discord.MessageEmbed()
.setColor('#fbfbfb')
.setTitle('Welcome to !')
.setThumbnail('https://s3.amazonaws.com/assets.enjin.com/users/20685959/pics/full/4179214.jpg')
.setDescription('Please select your roles below!\n\n'
+ `${TankEmoji} Tank\n`
+ `${DpsEmoji} Dps\n`
+ `${HealEmoji} Heal`)
.setTimestamp()
let messageEmbed = await message.channel.send(embed);
messageEmbed.react(TankEmoji);
messageEmbed.react(DpsEmoji);
messageEmbed.react(HealEmoji);
client.on('messageReactionAdd', async (reaction, user) => {
if (reaction.message.partial) await reaction.message.fetch();
if (reaction.partial) await reaction.fetch();
if (user.bot) return;
if (!reaction.message.guild) return;
if (reaction.message.channel.id == channel) {
if (reaction.emoji.name === TankEmoji) {
await reaction.message.guild.members.cache.get(user.id).roles.add(TankRole);
}
if (reaction.emoji.name === DpsEmoji) {
await reaction.message.guild.members.cache.get(user.id).roles.add(DpsRole);
}
if (reaction.emoji.name === HealEmoji) {
await reaction.message.guild.members.cache.get(user.id).roles.add(HealRole);
}
} else {
return;
}
});
client.on('messageReactionRemove', async (reaction, user) => {
if (reaction.message.partial) await reaction.message.fetch();
if (reaction.partial) await reaction.fetch();
if (user.bot) return;
if (!reaction.message.guild) return;
if (reaction.message.channel.id == channel) {
if (reaction.emoji.name === TankEmoji) {
await reaction.message.guild.members.cache.get(user.id).roles.remove(TankRole);
}
if (reaction.emoji.name === DpsEmoji) {
await reaction.message.guild.members.cache.get(user.id).roles.remove(DpsRole);
}
if (reaction.emoji.name === HealEmoji) {
await reaction.message.guild.members.cache.get(user.id).roles.remove(HealRole);
}
} else {
return;
}
});
}
}