我对javascript和discord.js还是很陌生,谁能帮助我并告诉我如何设置做出反应的用户的角色?我一直很难做到这一点。
client.on('messageReactionAdd', async (reaction, user) => {
if (reaction.message.partial) await reaction.message.fetch();
if (reaction.message.id === '755695010657206323') {
switch (reaction.emoji.id) {
case '753885482298900510':
break;
}
}
});
答案 0 :(得分:0)
使用user
对象来解析成员:
client.on('messageReactionAdd', async (reaction, user) => {
if (reaction.message.partial) await reaction.message.fetch();
if (reaction.message.id === '755695010657206323') {
switch (reaction.emoji.id) {
case '753885482298900510':
const member = await reaction.message.guild.members.fetch(user.id);
member.roles.add('ROLE_ID');
break;
}
}
});