TypeError: Cannot read property 'client' of undefined

#1

Hello.

I was coding my bot, when I got this error:

Here is the code:

const Discord = require(‘discord.js’);

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

let specifyembed = new Discord.MessageEmbed()
    .setColor(0xF55D5D)
    .setDescription(`${message.author}, Por favor especifica uma frase ou uma palavra.`)
    .setTimestamp();

if (!args[0]) return message.channel.send(specifyembed);

let embedsay = new Discord.MessageEmbed()
    .setColor('RANDOM')
    .setAuthor(message.author.tag, message.author.avatarURL)
    .setDescription(`${args[0]}`);

message.channel.send(embedsay);

};

exports.conf = {
enabled: true,
guildOnly: false,
aliases: [""],
permLevel: “User”
};

exports.help = {
name: “embed”,
category: “Outros”,
description: “Cria um embed com uma palavra ou frase especificada”,
usage: "embed "
};

What’s happening?

0 Likes

#2

Hi @TheBigerGamer if you’re still encountering this problem, what’s the project name?

0 Likes

#3

Hi @TheBigerGamer

replace with

    let specifyembed = new Discord.RichEmbed()
    .setColor(0xF55D5D)
    .setDescription(`${message.author}, Por favor especifica uma frase ou uma palavra.`)
    .setTimestamp();

    if (!args[0]) return message.channel.send(specifyembed);

    let embedsay = new Discord.RichEmbed()
    .setColor('RANDOM')
    .setAuthor(message.author.tag, message.author.avatarURL)
    .setDescription(`${args[0]}`);
    message.channel.send(embedsay);

let embed = new Discord.RichEmbed()
Use as

0 Likes

#4

The project name is testbot-js

0 Likes

#5

@TheBigerGamer

If you look at my answer

0 Likes