Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
I'm trying to make reaction roles using my own discord bot but for some reason it doesn't add the role even though it adds the reactions

I'm trying to make a discord bot that adds roles from reactions. I've been following a tutorial from CodeLyon and I hit a snag and I cant find a fix

Basically, I got the bot to send a embed message and it adds the reactions to the message. But it doesn't add the roles.

module.exports = {
  name: "reactionrole",
  description: "Sets up a reaction role message!",
  async execute(message, args, Discord, client) {
    const channel = "907732565685846036";
    const ACRole = message.guild.roles.cache.find(
      (role) => role.name === "Animal Crossing"
    );

    const ACEmoji = "🐸";

    let embed = new Discord.MessageEmbed()
      .setColor("#e42643")
      .setTitle("Choose which games you play!")
      .setDescription(
        "React to add the games you play as a role (and receive pings)\n\n" +
          `${ACEmoji} for Animal Crossing\n`
      );

    let messageEmbed = await message.channel.send({ embeds: [embed] });
    messageEmbed.react(ACEmoji);

    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 == channel) {
        if (reaction.emoji.name === ACEmoji) {
          await reaction.message.guild.members.cache
            .get(user.id)
            .roles.add(ACRole);
        }
      } 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 == channel) {
        if (reaction.emoji.name === ACEmoji) {
          await reaction.message.guild.members.cache
            .get(user.id)
            .roles.remove(ACRole);
        }
      } else {
        return;
      }
    });
  },
};
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

In my main.js (some people use index.js) file I had to change const client = new Discord.Client({ intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_MESSAGE'] }, { partials: ["MESSAGE", "CHANNEL", "REACTION" ] })

to

const client = new Discord.Client({ intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_MESSAGE_REACTIONS'] }, { partials: ["MESSAGE", "CHANNEL", "REACTION" ] })

It fixed it for a little bit but it randomly stopped working again.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda