I want to make a bot that gives roles when using reaction but I'm really stuck, I can't find anything on the documentation so I need help.
I already did this:
if (command == "role")
message.channel.send("Click on :emoji1: to get role1, :emoji2: to get role2 and :emoji3: to get role3.")
.then(sentMessage => {
sentMessage.react(":emoji1:")
sentMessage.react(":emoji2:")
sentMessage.react(":emoji3:")
});
It works just fine but I can't find how to add role when clicking a reaction.
答案 0 :(得分:1)
您可以使用messageReactionAdd
事件来实现此目的:
client.on('messageReactionAdd', (reaction, user) => {
reaction.message.guild.member(user).addRole('yourRole');
});