Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Discord.js, can't make discord embeds inside module.exports

I need help with discord.js. I can’t use discord embeds inside module.exports.

const Discord = require("discord.js");

module.exports = {
   name: "quote",
   aliases: ["quote", "quotes"],
   cooldowns: 3000,
   description: "Generates a random quote",
   usage: "To generate a random quote",
   toggleOff: false,
   developersOnly: false,
   userpermissions: ["SEND_MESSAGES", "VIEW_CHANNEL"],
   botpermissions: ["ADMINISTRATOR"],
   run: async (client, message, args) => {
      const getNextQuote = shuffler(quotes);
      const random  = getNextQuote();
      const embed = new Discord.MessageEmbed()
        .setColor('FF0000')
        .setImage(message.author.avatarURL)
        .setTitle("This is a quote")
        .setDescription("This is quote number")
        message.channel.send(embed);
        
   }
}; 

Every time I run the code I get an error,

DiscordAPIError: Cannot send an empty message

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

According to the official docs, you should wrap the embed like this:

channel.send({embeds: })
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading