DiscordAPIError[50006]: Cannot send an empty message

I'm trying to make a command that uses an API. When I execute this command, it says the application can't send empty messages even when it wasn't supposed to send a message.
const { steamApiKey } = require("../config.json");
const axios = require("axios");
const { EmbedBuilder } = require("discord.js");

module.exports = {
name: "steam",
description: "Exibe informações de um virjola da Steam.",
async execute(bot, message, args) {
if(!args) return await message.channel.send("Envie a sua Steam ID depois do comando para executá-lo.\nPara ver sua Steam ID, basta ir no site https://store.steampowered.com/account/ e verá sua identificação abaixo de seu nome.");

const id = args[0];
const url = `https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=${steamApiKey}&steamids=${id}`
await axios.get(url).then(res => {
console.log(res);
});

/*
const embed = new EmbedBuilder()
.setColor("#132c5d")
.setTitle();
*/
}
}
const { steamApiKey } = require("../config.json");
const axios = require("axios");
const { EmbedBuilder } = require("discord.js");

module.exports = {
name: "steam",
description: "Exibe informações de um virjola da Steam.",
async execute(bot, message, args) {
if(!args) return await message.channel.send("Envie a sua Steam ID depois do comando para executá-lo.\nPara ver sua Steam ID, basta ir no site https://store.steampowered.com/account/ e verá sua identificação abaixo de seu nome.");

const id = args[0];
const url = `https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=${steamApiKey}&steamids=${id}`
await axios.get(url).then(res => {
console.log(res);
});

/*
const embed = new EmbedBuilder()
.setColor("#132c5d")
.setTitle();
*/
}
}
6 Replies
d.js toolkit
d.js toolkit11mo 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
андреас (kanye's version)
Here's the error message:
/home/andreas/Documentos/maskeys/node_modules/@discordjs/rest/dist/index.js:722
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50006]: Cannot send an empty message
at handleErrors (/home/andreas/Documentos/maskeys/node_modules/@discordjs/rest/dist/index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/home/andreas/Documentos/maskeys/node_modules/@discordjs/rest/dist/index.js:1120:23)
at async SequentialHandler.queueRequest (/home/andreas/Documentos/maskeys/node_modules/@discordjs/rest/dist/index.js:953:14)
at async _REST.request (/home/andreas/Documentos/maskeys/node_modules/@discordjs/rest/dist/index.js:1266:22)
at async TextChannel.send (/home/andreas/Documentos/maskeys/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:155:15) {
requestBody: {
files: [],
json: {
content: '',
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: [],
sticker_ids: undefined,
thread_name: undefined
}
},
rawError: { message: 'Cannot send an empty message', code: 50006 },
code: 50006,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/channels/1199200226880266250/messages'
}
/home/andreas/Documentos/maskeys/node_modules/@discordjs/rest/dist/index.js:722
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50006]: Cannot send an empty message
at handleErrors (/home/andreas/Documentos/maskeys/node_modules/@discordjs/rest/dist/index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/home/andreas/Documentos/maskeys/node_modules/@discordjs/rest/dist/index.js:1120:23)
at async SequentialHandler.queueRequest (/home/andreas/Documentos/maskeys/node_modules/@discordjs/rest/dist/index.js:953:14)
at async _REST.request (/home/andreas/Documentos/maskeys/node_modules/@discordjs/rest/dist/index.js:1266:22)
at async TextChannel.send (/home/andreas/Documentos/maskeys/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:155:15) {
requestBody: {
files: [],
json: {
content: '',
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: [],
sticker_ids: undefined,
thread_name: undefined
}
},
rawError: { message: 'Cannot send an empty message', code: 50006 },
code: 50006,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/channels/1199200226880266250/messages'
}
monbrey
monbrey11mo ago
If this command isnt supposed to send a message then the error isnt coming from this command
андреас (kanye's version)
so what am i supposed to do?
monbrey
monbrey11mo ago
Find out where its actually coming from so I can actually help The channel id might help. Its attempting to send to 1199200226880266250
андреас (kanye's version)
good info nvm, already fixed it thanks
Want results from more Discord servers?
Add your server