Reaction Roles

How can I make Reactions that give you roles when you click it is there a simple way to do this most I've seen are long and complex
16 Replies
d.js toolkit
d.js toolkit12mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Syjalo
Syjalo12mo ago
Listen to messageReactionAdd and messageReactionRemove. Add and remove roles there.
Fractyl
Fractyl12mo ago
Do you have an example
d.js docs
d.js docs12mo ago
guide Popular Topics: Listening for reactions on old messages read more
Fractyl
Fractyl12mo ago
That looks rather complex
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Fractyl
Fractyl12mo ago
How would you respond after listening
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Fractyl
Fractyl12mo ago
Oof im a bit stupid so you may need to clarify further
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Fractyl
Fractyl12mo ago
do i need to make a whole new client in my slashcommand file ;/
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Fractyl
Fractyl12mo ago
So i could just do interaction.reaction.member => add role for example god im confused
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs12mo ago
event (event) Client#messageReactionAdd Emitted whenever a reaction is added to a cached event (event) Client#messageReactionRemove Emitted whenever a reaction is removed from a cached message.
enffinity
enffinity12mo ago
const { Client, Events, GatewayIntentBits, Partials } = require('discord.js');

const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions],
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});

client.on(Events.MessageReactionAdd, async (reaction, user) => {
if (reaction.partial) {
try {
await reaction.fetch();
} catch (error) {
console.error('Something went wrong when fetching the message:', error);
return;
}
}
console.log(`${reaction.message.author}'s message "${reaction.message.content}" gained a reaction!`);
console.log(`${reaction.count} user(s) have given the same reaction to this message!`);
});
const { Client, Events, GatewayIntentBits, Partials } = require('discord.js');

const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions],
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});

client.on(Events.MessageReactionAdd, async (reaction, user) => {
if (reaction.partial) {
try {
await reaction.fetch();
} catch (error) {
console.error('Something went wrong when fetching the message:', error);
return;
}
}
console.log(`${reaction.message.author}'s message "${reaction.message.content}" gained a reaction!`);
console.log(`${reaction.count} user(s) have given the same reaction to this message!`);
});
very complex i know
Want results from more Discord servers?
Add your server
More Posts