Home > Software design >  ReferenceError: embeds is not defined
ReferenceError: embeds is not defined

Time:10-22

When I run the terminal it gives me this error:

ReferenceError: embeds is not defined"

My version is 13.

Code:

const { MessageEmbed } = require('discord.js');
const Math = require('mathjs');

module.exports = {
    commands: "handhold",
    description: "handhold A Member",
    callback: (message, args) => {
        images = [
           "https://i.pinimg.com/originals/47/d1/8b/47d18b56a850217a46b517da4325d132.gif",
           "https://c.tenor.com/WUZAwo5KFdMAAAAC/love-holding-hands.gif",
           "https://i.pinimg.com/originals/0c/9e/33/0c9e33a5d3d033b11d6c70dfaf0f83f8.gif",
           "https://c.tenor.com/rU3xZo2_jaIAAAAC/anime-hold.gif",
           "https://c.tenor.com/zBxywfOKGw8AAAAC/holding-hands.gif",
           "https://c.tenor.com/rU3xZo2_jaIAAAAC/anime-hold.gif",
           "https://yunikonureshii.files.wordpress.com/2019/06/tumblr_oqu3n2fx1k1v8tshbo1_400.gif?w=364",
           "https://64.media.tumblr.com/c34737f765da6ba730091207adf5db6e/tumblr_onnkriak9p1viiyyio1_500.gif",
           "https://i.imgur.com/A9kxW4y.gif",
        ]

        member = message.mentions.members.first();
                const embed1 = new MessageEmbed()
                .setColor('#000000')

                const embed2 = new MessageEmbed()
                .setColor('#000000')

                const embed3 = new MessageEmbed()
                .setColor('#000000')

        if (!member) return message.channel.send({ embeds: [embed1.setDescription("You need to mention a user to **handhold**!")] }) // Mention To hold.
        else if (message.mentions.users.first().id === '889734836955283467>') // if the person mentioned was Baji Bot
        return message.channel.send({ embeds: [embed3.setDescription("I'm a bot, I don't have hands..")] }) 
        else if (member.id === message.author.id) return message.channel.send({ embeds: [embed2.setDescription('Are you holding your own hands? :)')] })

        const embed = new MessageEmbed()
            .setDescription(`:two_hearts:${message.member}'s Hands have been holded by ${member}`)
            .setImage(images[Math.floor(Math.random() * images.length)])
            .setColor('#000000')
            .setTimestamp()

        message.channel.send(embeds)
    }
}

The handhold command doesn't work, why?

message.channel.send(embeds)
                         

CodePudding user response:

You have to change message.channel.send(embeds) to:

message.channel.send({ embeds: [embed] })

  • Related