Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

414
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda