Application did not respond

Hey there! I decided to hop into discord js without almost no js knowledge (I know, not a good practice). I'm currently trying to create a slash command. The command is registered, however it seems like the async execute part of my slash builder is not working? Would appreciate some help.
10 Replies
d.js toolkit
d.js toolkit2d 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
Szarvasi SZV-623 Cafe Brill
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('sziabazdmeg')
.setDescription('Dögöljön meg a js ott ahol van.'),
async execute(interaction) {
await interaction.deferReply();
await interaction.editReply('stroke');
},
};
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('sziabazdmeg')
.setDescription('Dögöljön meg a js ott ahol van.'),
async execute(interaction) {
await interaction.deferReply();
await interaction.editReply('stroke');
},
};
I tried defering it, but no luck. Also, no errors in the console. Just the application didn't respond. I don't think I have one. Didn't see the docs referring to one. I might be just blind tho 😄
d.js docs
d.js docs2d ago
:guide: Creating Your Bot: Command handling read more
Szarvasi SZV-623 Cafe Brill
Thanks! I modified my code accordingly but I get a Cannot read properties of undefined (reading 'commands') error now When trying to execute a command Here's how my code looks like now
bot.on(Events.InteractionCreate, interaction => {
if (!interaction.isChatInputCommand()) return;
const command = interaction.bot.commands.get(interaction.commandName);
command.execute(interaction);
});
bot.on(Events.InteractionCreate, interaction => {
if (!interaction.isChatInputCommand()) return;
const command = interaction.bot.commands.get(interaction.commandName);
command.execute(interaction);
});
Retro
Retro2d ago
bot is not a property on interaction
NyR
NyR2d ago
it should be interaction.client
Szarvasi SZV-623 Cafe Brill
How come? I have my client defined as bot, It works with interaction.client though so thank you both
treble/luna
treble/luna2d ago
thats just the variable name you gave it in your index i would suggest learning the basics of js first because as you mentioned, its not a good idea to code a bot without any knowledge (and having this knowledge is a requirement, as per #rules 3)
Szarvasi SZV-623 Cafe Brill
Hmm alrighty Thanks for the help

Did you find this page helpful?