module.exports = {
name: 'rearole',
description: "Sets up a reaction role message!",
async execute(message, args, Discord, client) {
const channelID = '814125436698099752';
const EmojiRole = message.guild.roles.cache.find(role => role.name === "ПОДПИСКА");
const EmojiTeam = '<:anicloud:717681818127826964>';
let embed = new Discord.MessageEmbed()
.setColor('#000000')
.setTitle('Оповещение об обновлениях')
.setDescription(`Нажми на эмодзи ${EmojiTeam} чтобы получать оповещения!`);
let messageEmbed = await message.channel.send(embed);
messageEmbed.react(EmojiTeam);
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 == channelID) {
if (reaction.emoji.name === EmojiTeam) {
await reaction.message.guild.members.cache.get(user.id).roles.add(EmojiRole);
}
} 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 == channelID) {
if (reaction.emoji.name === EmojiTeam) {
await reaction.message.guild.members.cache.get(user.id).roles.remove(EmojiRole);
}
} else {
return;
}
});
}
}
await reaction.message.guild.members.cache.get(user.id).roles.add(EmojiRole);
что это? await выполняет add(...), а не get(). Нужно же знать синтаксис.let member = await reaction.message.guild.members.cache.get(user.id);
member.roles.add(EmojiRole);