It’s me again..
Alright so:
I’m trying to make a command that will warn users they joined a wrong server, But when I run the command, I get the Cannot send an empty msg error..
Really, any help would be appreciated!
const Discord = require("discord.js") module.exports.run = async (client, message, args, err) => { const embed = new Discord.MessageEmbed().setTitle('Hey!').setDescription('We think you have our server mistaken. etc etc') if (!args[0]) return message.reply('Who?', { allowedMentions: { repliedUser: false } }); const member = message.mentions.members.first() || await message.guild.members.fetch(args[0]).catch(e => { check = true; return message.reply('Can't find specefied member! Provide a valid ID, or mention ig lol.', { allowedMentions: { repliedUser: false } }); }); message.channel.send(embed).catch(err) message.channel.send(`${member}`) }
Error:
DiscordAPIError: Cannot send an empty message at RequestHandler.execute (C:UsersstupkDesktopHolonode_modulesdiscord.jssrcrestRequestHandler.js:298:13) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async RequestHandler.push (C:UsersstupkDesktopHolonode_modulesdiscord.jssrcrestRequestHandler.js:50:14) { method: 'post', path: '/channels/843567563648139317/messages', code: 50006, httpStatus: 400, requestData: { json: { content: undefined, tts: false, nonce: undefined, embeds: undefined, components: undefined, username: undefined, avatar_url: undefined, allowed_mentions: undefined, flags: undefined, message_reference: undefined, attachments: undefined }, files: [] } }
Advertisement
Answer
From discord.js v13 onwards, the API supports up to 10 embeds per message.
So, instead of:
message.channel.send({ embed: embed })
Pass in an array of embeds instead:
message.channel.send({ embeds: [embed1, embed2, embed3... embed10] })
You can, of course, just insert a single embed as well:
message.channel.send({ embeds: })
Changelog: https://discordjs.guide/additional-info/changes-in-v13.html#sending-messages-embeds-files-etc
You might find some extra stuff in there as well.