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

415
Visualizações
accept or decline with reaction but it doesn't work discord.js v13 (javascript)

I wanna send the suggestion to a channel with two reaction then if the admin reacted ✅ send it to another channel and if ❌ delete it. I tried this but first it can't send embed it says Cannot read properties of undefined (reading 'discord') and I tried without embed and I used reactions but doesn't work

Code:

module.exports = {
name: "suggest",
category: "Suggestion",
description: "suggest something",
usage: "suggest [text]",
owner: false,
execute(message, args, client) {
    message.reply({ content: "..." }).then(async(msg) => {
        const sug = args[0];
        const suggestion = args.join(" ");
        if (!sug) {
            message.delete();
            msg.edit({
                content: `[ You did not provide a suggestion ]`,
            })
        } else {
                const acceptch = message.guild.channels.cache.get('980126282719313970');
                if (err) {
                    message.delete();
                    msg.edit({
                        content: `[ ${err} ]`,
                    })
                } else {
                    const embed = new client.discord.MessageEmbed()
                        .setColor('0b9494')
                        .setAuthor(message.author.tag, message.author.displayAvatarURL())
                        .setDescription(suggestion)
                    acceptch.send(embed)
                        .then(msg => {
                            msg.react('✅').then(() => msg.react('❌'));

                            msg.awaitReactions((reaction, user) => user.id == '746917945065865376' && (reaction.emoji.name == '✅' || reaction.emoji.name == '❌'), { max: 1, time: 60000, errors: ['time'] })
                                .then(collected => {
                                    const reaction = collected.first();
                                    if (reaction.emoji.name === '❌') {
                                        return message.author.send('**no**')
                                    }
                                    if (reaction.emoji.name === '✅') {
                                        message.channel.send(`suggestion: ${suggestion}`)
                                    }
                                });
                        }).catch(console.error);
                }
        }

    })
}

}

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

If you check the discord.js documentation for "Client" class, there is no such thing as client.discord.

Which is why this line const embed = new client.discord.MessageEmbed() from your code throws error, because your are trying to access property "MessageEmbed" of object that is undefined.

You can add const { MessageEmbed } = require('discord.js') at the beginning of that file and then just use const embed = new MessageEmbed().

about 4 years ago · Juan Pablo Isaza Relatório

0

in discord js v13 we can no longer use acceptch.send(embed) as they said here we have to send embeds like this acceptch.send({ embeds: [embed] });

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