Slash command working but still replying with "The application did not respond"

the command works but before its sent it responds with "The application did not respond".
const { EmbedBuilder, PermissionsBitField } = require("discord.js");
const { SlashCommandBuilder } = require("@discordjs/builders");
const config = require("../config");
const axios = require('axios');
const key = config.key

// Guide: https://discordjs.guide/slash-commands/advanced-creation.html

module.exports = {
data: new SlashCommandBuilder()
.setName("test")
.setDescription("test"),

run: async (client, interaction) => {

axios
.get(`api link`)
.then((res) => {

const data = JSON.stringify(res.data);

const exampleEmbed = new EmbedBuilder()
.setColor(0xff0000)
.setTitle('test ')
.setDescription(data)

interaction.channel.send({ embeds: [exampleEmbed] });
})
}
};
const { EmbedBuilder, PermissionsBitField } = require("discord.js");
const { SlashCommandBuilder } = require("@discordjs/builders");
const config = require("../config");
const axios = require('axios');
const key = config.key

// Guide: https://discordjs.guide/slash-commands/advanced-creation.html

module.exports = {
data: new SlashCommandBuilder()
.setName("test")
.setDescription("test"),

run: async (client, interaction) => {

axios
.get(`api link`)
.then((res) => {

const data = JSON.stringify(res.data);

const exampleEmbed = new EmbedBuilder()
.setColor(0xff0000)
.setTitle('test ')
.setDescription(data)

interaction.channel.send({ embeds: [exampleEmbed] });
})
}
};
40 Replies
d.js toolkit
d.js toolkit10mo 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!
v.dll
v.dllOP10mo ago
No description
PAIDODAMASTIS
PAIDODAMASTIS10mo ago
you want to send embed with slash commands?
v.dll
v.dllOP10mo ago
no the embed is sending but
jay
jay10mo ago
interaction.channel.send is not a reply
v.dll
v.dllOP10mo ago
it just says that
jay
jay10mo ago
you need to reply
v.dll
v.dllOP10mo ago
when i reply it doesnt work it pushes an error DiscordAPIError[10062]: Unknown interaction this one
jay
jay10mo ago
that usually means you didn’t reply in time
d.js docs
d.js docs10mo ago
Common causes of DiscordAPIError[10062]: Unknown interaction: - Initial response took more than 3 seconds ➞ defer the response *. - Wrong interaction object inside a collector. - Two processes handling the same command (the first consumes the interaction, so it won't be valid for the other instance) * Note: you cannot defer modal or autocomplete value responses
v.dll
v.dllOP10mo ago
No description
v.dll
v.dllOP10mo ago
so what do i do then if i change it to that the embed doesnt send and i keep it like this and it says "The application did not respond"
PAIDODAMASTIS
PAIDODAMASTIS10mo ago
you want the app to send embed messages?
v.dll
v.dllOP10mo ago
yeah its sending the embed tho its just the "The application did not respond"
jay
jay10mo ago
interaction.reply
v.dll
v.dllOP10mo ago
ive already tried that
PAIDODAMASTIS
PAIDODAMASTIS10mo ago
await interaction.reply
v.dll
v.dllOP10mo ago
then the cmd doesnt work
jay
jay10mo ago
you can defer it
d.js docs
d.js docs10mo ago
guide Slash Commands: Command response methods - Deferred responses In this case, you can make use of the ChatInputCommandInteraction#deferReply() method, which triggers the <application> is thinking... message. This also acts as the initial response, to confirm to Discord that the interaction was received successfully and gives you a 15-minute timeframe to your... read more
PAIDODAMASTIS
PAIDODAMASTIS10mo ago
wis try this code for an embed
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('embed')
.setDescription('Create an embed')
.addStringOption(option =>
option.setName('title')
.setDescription('Title of the embed')
.setRequired(true)
)
.addStringOption(option =>
option.setName('description')
.setDescription('Description of the embed')
.setRequired(true)
),
async execute(interaction) {
const title = interaction.options.getString('title');
const description = interaction.options.getString('description');


const embed = {
color: 0x0099ff,
title: title,
description: description,
};


await interaction.reply({ embeds: [embed] });
},
};
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('embed')
.setDescription('Create an embed')
.addStringOption(option =>
option.setName('title')
.setDescription('Title of the embed')
.setRequired(true)
)
.addStringOption(option =>
option.setName('description')
.setDescription('Description of the embed')
.setRequired(true)
),
async execute(interaction) {
const title = interaction.options.getString('title');
const description = interaction.options.getString('description');


const embed = {
color: 0x0099ff,
title: title,
description: description,
};


await interaction.reply({ embeds: [embed] });
},
};
this also gives you an option for description and title
v.dll
v.dllOP10mo ago
didnt work
v.dll
v.dllOP10mo ago
No description
v.dll
v.dllOP10mo ago
now the embed doesnt even send
treble/luna
treble/luna10mo ago
please dont spoonfeed code
v.dll
v.dllOP10mo ago
doesnt work to begin with
treble/luna
treble/luna10mo ago
because this code has 0 relation to your issue you have to defer the reply, as you were told
v.dll
v.dllOP10mo ago
i have anything else?
treble/luna
treble/luna10mo ago
and does it work
v.dll
v.dllOP10mo ago
no it doesnt
treble/luna
treble/luna10mo ago
and what error do you get, what works, what doesnt, wahts your updated code
v.dll
v.dllOP10mo ago
interaction.deferUpdate(); right?
treble/luna
treble/luna10mo ago
there is no such function on a chatinput interaction please read
PAIDODAMASTIS
PAIDODAMASTIS10mo ago
He said he wanted to send embed with slash commands So I send the code bro
treble/luna
treble/luna10mo ago
read #how-to-get-help the code you showed has nothing to do with their issue dont just blindly read a forum title and dont spoonfeed
PAIDODAMASTIS
PAIDODAMASTIS10mo ago
. Ok bro I was just helping
treble/luna
treble/luna10mo ago
you still dont need to spoonfeed and actually help them with their actual issue
mushtaq
mushtaq10mo ago
defer reply should work I had the same issue some time back
Mortai
Mortai10mo ago
just send a reply saying "loading" and then after you have completed the calculations edit the reply with the embed
-_-العربي الفصيح-_-
Or just use interaction.deleteReply(); instead of editing the reply
Want results from more Discord servers?
Add your server