1
votes

I am currently working on a discord bot for a friend of mine.

I want to send an embed message after checking if the user has a certain role. Everytime I get the error:

DiscordAPIError: Cannot send an empty message

That's the code:

const Discord = require('discord.js');
module.exports = {
name: "game".toLowerCase(),
description: "Waehle dein Spiel aus",
aliases: ['spiel'],

execute(message) {
    const member = message.member;
    if (member.roles.cache.some(role => role.name === '⚜️Admin⚜️')) {

        const gameEmbed = new Discord.MessageEmbed()
        .setTitle("Apply Rules")
        .setURL("https://www.google.com")
        .setColor(0x00AE86)

        .setDescription(`Test`)


        .setFooter("Community Bot v1.0")
        .setTimestamp()

        message.channel.send({gameEmbed});
    } 
    else {
        console.log('user has not admin');
    }
 }
}

Can anyone help me figuring out why I get the error every time?

1

1 Answers

1
votes

Replace message.channel.send({gameEmbed}); with message.channel.send(gameEmbed);