A
A
anubis4652021-07-19 19:35:12
Node.js
anubis465, 2021-07-19 19:35:12

How to post a reaction to a bot message?

Reactions are published under the message of the user, not the bot, I would like to fix this. If I try to use .then, then the bot reacts to its reaction. How can I fix it?

const Discord = require("discord.js");

exports.run = (client, message, args) => {


let attach = message.attachments.map(x => x.proxyURL)[0]
if(!attach) attach = ""


const ModEmbed = new Discord.MessageEmbed()
.setDescription("Ку-ку! Пришла картинка на модерацию! Проверьте ее.")
.setImage(attach)
client.channels.cache.get('866701909867233340').send(ModEmbed)

message.react('').then(() => message.react(''));

const filter = (reaction, user) => {
  return ['', ''].includes(reaction.emoji.name) && user.id === message.author.id;
};

message.awaitReactions(filter, { max: 1, errors: ['time'] })
  .then(collected => {
    const reaction = collected.first();

    if (!user.bot && reaction.emoji.name === '') {

      message.reply('Изображение успешно опубликовано!');

      const GodEmbed = new Discord.MessageEmbed()
      .setTitle("Кто-то поделился картинкой!") 
      .setImage(attach)
      
            client.channels.cache.get('866701909867233340').send(GodEmbed)
    } else {
      message.reply('Вы отменили публикацию.');
    }
  })
  .catch(collected => {
    message.channel.send('Что блять.');
  });
}

exports.help = {
    name: "gramm"
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question