The problem is that sometimes it works and sometimes it generates an error, and I've already tried it without using defer, same result.
How my Main class register commands
export default class MyClient extends Client {
constructor(options) {
super(options);
this.slashCommandsArray = [];
this.loadEvents();
this.loadSlashCommands();
};
async registerCommands() {
await this.application.commands.set(this.slashCommandsArray, "guild_id");
};
}```
My interactionCreate Class
```js
export default class InteractionCreate extends ReadyClient {
constructor(client) {
super(client, {
name: "interactionCreate"
})
}
execute = async(interaction) => {
const commandName = interaction.commandName;
const command = this.client.slashCommandsArray.find(cmd => cmd.name === commandName);
if(!command) return;
await interaction.deferReply();
await command.execute(interaction);
}
}
my test command
export default class Ping extends SlashCommands {
constructor(client) {
super(client, {
data: new SlashCommandBuilder()
.setName("ping")
.setDescription("Reply with pong")
});
};
execute = async(interaction) => {
await interaction.editReply("Pong!");
};
};