S
S
Seque2021-10-02 06:47:00
Node.js
Seque, 2021-10-02 06:47:00

Reaction under the post. How to fix?

I have a function responsible for informing the role about violations in the discord channels. I need to add an emotion to this message (which tags the desired role), by pressing which, the bot sends messages.

Now I have this code:

if (foundBadWords) {
    client.channels.cache.get("792034371304685583").send({content: `<@&881924857351274517>, необходимо глянуть:`, embeds: [embedlogt]})
    .then(message => {
    message.react('❓')
    .then(() => message.react('❓'))});
   }
   const filter = (reaction, user) => {
     return reaction.emoji.name === '❓';
   };
   const collector = message.createReactionCollector(filter, {max: 2}); 
   collector.on('collect', (reaction, user) => {
     message.channel.send({embeds: [infoab]});
      });
});


At the moment, it is necessary to put a reaction to the author's message, where the bot detected a violation. How can I change this to put a reaction on the message of the bot itself, and then the code I need is sent? 6157d5e448ce1529870102.jpeg

In addition: this code is now in client.on(`messageCreate`, message => {}

Works like this:
Detects a word, sends a message with a role tag and adds a reaction to it. If the user clicks on it, then some code is executed. In In my case, the reaction works on the messages of the author, but not the bot.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2021-10-02
@Seque

channel.send("сообщение").then(m => {
  m.react("❓");
  
  const filter = (reaction, user) => {
    return reaction.emoji.name === '❓';
  };
  
  const collector = message.createReactionCollector(filter, {
    max: 2
  });
  
  collector.on('collect', (reaction, user) => {
    message.channel.send({
      embeds: [infoab]
    });
  });
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question