EmbedBuilder sends an empty message

I'm trying to send an embed using the interaction.editReply() way. However when I execute the command I get an error DiscordAPIError[50006]: Cannot send an empty message.
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js');

async function createLobby(interaction, options) {
await interaction.deferReply({ ephemeral: true});

const size = options.get('size').value;
const name = options.get('name').value;
const description = options.get('description') ? options.get('description').value : 'No description provided.';
let color = 0x17fc03;
const footerObject = {
text: 'Initiated by ' + interaction.user.username,
icon_url: interaction.user.avatarURL()
}

const lobbyEmbed = new EmbedBuilder()
.setColor(color)
.setTitle(name)
.setDescription(description)
.addFields(
{ name: 'Lobby Size', value: size, inline: false },
)
.setTimestamp()
.setFooter(footerObject);

interaction.editReply({ embed: [lobbyEmbed], ephemeral: true });
}

module.exports = createLobby;
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder } = require('discord.js');

async function createLobby(interaction, options) {
await interaction.deferReply({ ephemeral: true});

const size = options.get('size').value;
const name = options.get('name').value;
const description = options.get('description') ? options.get('description').value : 'No description provided.';
let color = 0x17fc03;
const footerObject = {
text: 'Initiated by ' + interaction.user.username,
icon_url: interaction.user.avatarURL()
}

const lobbyEmbed = new EmbedBuilder()
.setColor(color)
.setTitle(name)
.setDescription(description)
.addFields(
{ name: 'Lobby Size', value: size, inline: false },
)
.setTimestamp()
.setFooter(footerObject);

interaction.editReply({ embed: [lobbyEmbed], ephemeral: true });
}

module.exports = createLobby;
I'm not sure if in this new version this technique still works the same way as in 14.14.x. Do I need to send it, and not edit the reply? Thanks for the help in advance!
4 Replies
d.js toolkit
d.js toolkit7mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Chili
ChiliOP7mo ago
Full error stack trace below:
C:\Users\kralv\Desktop\Olympia\IT\Pegasus\node_modules\@discordjs\rest\dist\index.js:730
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50006]: Cannot send an empty message
at handleErrors (C:\Users\kralv\Desktop\Olympia\IT\Pegasus\node_modules\@discordjs\rest\dist\index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\kralv\Desktop\Olympia\IT\Pegasus\node_modules\@discordjs\rest\dist\index.js:1133:23)
at async SequentialHandler.queueRequest (C:\Users\kralv\Desktop\Olympia\IT\Pegasus\node_modules\@discordjs\rest\dist\index.js:963:14)
at async _REST.request (C:\Users\kralv\Desktop\Olympia\IT\Pegasus\node_modules\@discordjs\rest\dist\index.js:1278:22)
at async InteractionWebhook.editMessage (C:\Users\kralv\Desktop\Olympia\IT\Pegasus\node_modules\discord.js\src\structures\Webhook.js:341:15)
at async ChatInputCommandInteraction.editReply (C:\Users\kralv\Desktop\Olympia\IT\Pegasus\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:161:17) {
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
enforce_nonce: false,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 64,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined,
applied_tags: undefined,
poll: undefined
}
},
C:\Users\kralv\Desktop\Olympia\IT\Pegasus\node_modules\@discordjs\rest\dist\index.js:730
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50006]: Cannot send an empty message
at handleErrors (C:\Users\kralv\Desktop\Olympia\IT\Pegasus\node_modules\@discordjs\rest\dist\index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\kralv\Desktop\Olympia\IT\Pegasus\node_modules\@discordjs\rest\dist\index.js:1133:23)
at async SequentialHandler.queueRequest (C:\Users\kralv\Desktop\Olympia\IT\Pegasus\node_modules\@discordjs\rest\dist\index.js:963:14)
at async _REST.request (C:\Users\kralv\Desktop\Olympia\IT\Pegasus\node_modules\@discordjs\rest\dist\index.js:1278:22)
at async InteractionWebhook.editMessage (C:\Users\kralv\Desktop\Olympia\IT\Pegasus\node_modules\discord.js\src\structures\Webhook.js:341:15)
at async ChatInputCommandInteraction.editReply (C:\Users\kralv\Desktop\Olympia\IT\Pegasus\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:161:17) {
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
enforce_nonce: false,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 64,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined,
applied_tags: undefined,
poll: undefined
}
},
rawError: { message: 'Cannot send an empty message', code: 50006 },
code: 50006,
status: 400,
method: 'PATCH',
url: 'https://discord.com/api/v10/webhooks/1245388245353893918/aW50ZXJhY3Rpb246MTI0NTQzNDYyMzgxMTY1MzYzMjoxYXJsaU5aZGQxWEhqelZPVnBXNTJUMjB4UFVsWGdBc281SmdqYndtQkJ5aDRFQUhvc1VZbnFFU2VNQ3Y4cGN5OGhYU21oNEViM1BvWWdqaEhRUDBSZGFiRHA5M0pRV3ZONkwzam5KM3luRFI5d21JeTFjUHpBWENzNll4OWRocA/messages/@original'
}

Node.js v20.9.0
rawError: { message: 'Cannot send an empty message', code: 50006 },
code: 50006,
status: 400,
method: 'PATCH',
url: 'https://discord.com/api/v10/webhooks/1245388245353893918/aW50ZXJhY3Rpb246MTI0NTQzNDYyMzgxMTY1MzYzMjoxYXJsaU5aZGQxWEhqelZPVnBXNTJUMjB4UFVsWGdBc281SmdqYndtQkJ5aDRFQUhvc1VZbnFFU2VNQ3Y4cGN5OGhYU21oNEViM1BvWWdqaEhRUDBSZGFiRHA5M0pRV3ZONkwzam5KM3luRFI5d21JeTFjUHpBWENzNll4OWRocA/messages/@original'
}

Node.js v20.9.0
TÆMBØ
TÆMBØ7mo ago
- embed: [lobbyEmbed]
+ embeds: [lobbyEmbed]
- embed: [lobbyEmbed]
+ embeds: [lobbyEmbed]
Chili
ChiliOP7mo ago
Oh, haha thank you!
Want results from more Discord servers?
Add your server