Why does it just say "application didn't respond"?

const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const Utils = require('../../utils');

module.exports = {
data: new SlashCommandBuilder()
.setName('ban')
.setDescription('Ban a player from the server')
.addUserOption(option =>
option.setName('user')
.setDescription('The user to ban')
.setRequired(true))
.addStringOption(option =>
option.setName('time')
.setDescription('The time to ban the user for'))
.addStringOption(option =>
option.setName('reason')
.setDescription('The reason to ban the user for')),
async execute(interaction) {
const user = interaction.options.getUser('user');
const time = interaction.options.getUser('time');
const reason = interaction.options.getUser('reason');

const channel = await client.channels.fetch("1198299044582281216", { force: true });
const embed = new EmbedBuilder()
embed.setTitle("test")
await interaction.reply({ embeds: [embed] })
},
};
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const Utils = require('../../utils');

module.exports = {
data: new SlashCommandBuilder()
.setName('ban')
.setDescription('Ban a player from the server')
.addUserOption(option =>
option.setName('user')
.setDescription('The user to ban')
.setRequired(true))
.addStringOption(option =>
option.setName('time')
.setDescription('The time to ban the user for'))
.addStringOption(option =>
option.setName('reason')
.setDescription('The reason to ban the user for')),
async execute(interaction) {
const user = interaction.options.getUser('user');
const time = interaction.options.getUser('time');
const reason = interaction.options.getUser('reason');

const channel = await client.channels.fetch("1198299044582281216", { force: true });
const embed = new EmbedBuilder()
embed.setTitle("test")
await interaction.reply({ embeds: [embed] })
},
};
client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isChatInputCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);

if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}

try {
await command.execute(interaction);
} catch (error) {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
} else {
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
}
});
client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isChatInputCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);

if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}

try {
await command.execute(interaction);
} catch (error) {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
} else {
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
}
});
and it just says No command matching ban was found. in the console.
12 Replies
d.js toolkit
d.js toolkit9mo 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!
Amgelo
Amgelo9mo ago
where do you register internally that ban command file not in djs but where do you save it on client.commands
Tissemyren
TissemyrenOP9mo ago
In my index.js Just followed the documentation as well as I could
d.js docs
d.js docs9mo ago
:guide: Creating Your Bot: Command handling read more :guide: Creating Your Bot: Registering slash commands read more
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
Tissemyren
TissemyrenOP9mo ago
Okay, but I don't really understand. Here it says to put the script in index.js but here it says to put it in deploy-commands.js
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
Tissemyren
TissemyrenOP9mo ago
No description
Tissemyren
TissemyrenOP9mo ago
I probably just misunderstood it
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
Amgelo
Amgelo9mo ago
you are deploying your commands on discord but you aren't storing them in your bot process so when your bot receives a command, your internal command map is empty
Tissemyren
TissemyrenOP9mo ago
oh, now it works, thanks :D
Want results from more Discord servers?
Add your server