I'm attempting to create a more complex reaction role function.
Basically I want to achieve that if a user has 2 roles, it should have access to some channels. So the way I'm trying to do this is by checking if the user has one of the roles when clicking on a reaction that grants the member the second role. If the user has the other role, he should get a third role that unlocks these channels.
But, I haven't been able to figure out how to look at the roles of the person reacting to the message.
client.on('messageReactionAdd', async (reaction, user) => {
const message = await reaction.message.fetch(true);
const channelAccess = '918617193988649002';
const foodSweden = message.guild.roles.cache.find(role => role.name === '');
const foodCategoryReaction = '';
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 === channelAccess) {
if (reaction.emoji.name === foodCategoryReaction && message.member.roles.has('')) {
await reaction.message.guild.members.cache.get(user.id).roles.add(foodSweden);
} else {
return;
}
}
});
So this is the code. I'm uncertain how message.member.roles.has('') should be coded.
I've tried reaction.message.member.roles.has(''), reaction.member.roles.has(''), user.roles.has('') and shifted out member for user.