Chain God
Chain God

Reputation: 9

discord.js embed Cannot send an empty message

im trying to do an embed, but every time i try using it, it says "DiscordAPIError: Cannot send an empty message"

Here is the embed and everything related to it:

client.on('message',(message) => {
    if(message.author.bot) return;
        let botMessageLog = new Discord.MessageEmbed()
        .setAuthor(`Logs`, client.user.avatarURL())
        .setDescription(`**${message.author.toString()}** said: **${message.content}** in channel **${message.channel.toString()}**`)
        .setFooter(`Log system`, client.user.avatarURL())
        .setTimestamp()
        .setColor("FF0000");
        bot.channels.cache.get("1018767166218182668").send(botMessageLog)
});

Upvotes: -2

Views: 227

Answers (1)

Siyam Hosan
Siyam Hosan

Reputation: 37

You are doing many things wrong if you are using discord js v 14

hare is a quick fix


const {Client, EmbedBuilder} = require("discord.js")
//define a new client

client.on('messageCreate',(message) => {
    if(message.author.bot) return;
        let botMessageLog = new EmbedBuilder()
        .setAuthor({name:`Logs`,iconURL: client.user.displayAvatarURL()})
        .setDescription(`**${message.author.username}** said: **${message.content}** in channel **${message.channel.name}**`)
        .setFooter({text:`Log system`, iconURL: client.user.displayAvatarURL()  })
        .setTimestamp()
        .setColor("FF0000");
        bot.channels.cache.get("1018767166218182668").send({embeds:[botMessageLog]})
        //you must define bot as client
})

it always better if you use the latest Version of discord js

Upvotes: 1

Related Questions