Dopi
Dopi
DIdiscord.js - Imagine ❄
Created by Dopi on 12/16/2024 in #djs-questions
SlashCommand interaction is undefined
It's working now, thanks for your quick help! ❤️
15 replies
DIdiscord.js - Imagine ❄
Created by Dopi on 12/16/2024 in #djs-questions
SlashCommand interaction is undefined
Yeah that was the issue 😄 the typing of the execute function was wrong thats why I haven't noticed the issue there
15 replies
DIdiscord.js - Imagine ❄
Created by Dopi on 12/16/2024 in #djs-questions
SlashCommand interaction is undefined
Ohh whoops you are right ... I'm wondering how this was working before 😅
15 replies
DIdiscord.js - Imagine ❄
Created by Dopi on 12/16/2024 in #djs-questions
SlashCommand interaction is undefined
Okay, that was not the Issue ... interactionCreate.ts
module.exports = {
name: Events.InteractionCreate,
async execute(interaction: Interaction) {
if (!interaction.isChatInputCommand()) return;
// SmeetaClient#commands is typed the following:
// public commands: Collection<string, ExportedSlashCommand>;
// I checked and can confirm the Collection is filled as it should be
const command = (interaction.client as SmeetaClient).commands.get(interaction.commandName);

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

try {
await command.execute();
} 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 });
}
}
},
};
module.exports = {
name: Events.InteractionCreate,
async execute(interaction: Interaction) {
if (!interaction.isChatInputCommand()) return;
// SmeetaClient#commands is typed the following:
// public commands: Collection<string, ExportedSlashCommand>;
// I checked and can confirm the Collection is filled as it should be
const command = (interaction.client as SmeetaClient).commands.get(interaction.commandName);

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

try {
await command.execute();
} 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 });
}
}
},
};
15 replies
DIdiscord.js - Imagine ❄
Created by Dopi on 12/16/2024 in #djs-questions
SlashCommand interaction is undefined
Sure, I just found something there that could cause the issue, I'll check that first 👍
15 replies