Skip to content

Commit face04b

Browse files
committed
fix(discord-bot): dedupe interaction routing
1 parent 0c99851 commit face04b

1 file changed

Lines changed: 0 additions & 39 deletions

File tree

src/handlers/EventHandler.js

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -108,45 +108,6 @@ class EventHandler {
108108
}
109109
});
110110

111-
// Interaction create event (for slash commands)
112-
this.client.on(Events.InteractionCreate, async (interaction) => {
113-
if (!interaction.isChatInputCommand()) return;
114-
115-
const command = this.client.commands?.get(interaction.commandName);
116-
if (!command) return;
117-
118-
try {
119-
// Check if command is guild only
120-
if (command.guildOnly && !interaction.guild) {
121-
return interaction.reply({
122-
content: 'This command can only be used in a server!',
123-
ephemeral: true
124-
});
125-
}
126-
127-
// Check permissions
128-
if (command.permissions && !interaction.member?.permissions.has(command.permissions)) {
129-
return interaction.reply({
130-
content: 'You do not have permission to use this command!',
131-
ephemeral: true
132-
});
133-
}
134-
135-
// Execute command
136-
await command.execute(interaction);
137-
logger.info(`Slash command executed: ${interaction.commandName} by ${interaction.user.tag} in ${interaction.guild?.name || 'DM'}`);
138-
} catch (error) {
139-
logger.error(`Error executing slash command ${interaction.commandName}:`, error);
140-
141-
const errorMessage = 'There was an error while executing this command!';
142-
if (interaction.replied || interaction.deferred) {
143-
await interaction.followUp({ content: errorMessage, ephemeral: true });
144-
} else {
145-
await interaction.reply({ content: errorMessage, ephemeral: true });
146-
}
147-
}
148-
});
149-
150111
// Voice state update event
151112
this.client.on(Events.VoiceStateUpdate, (oldState, newState) => {
152113
// Handle voice state changes if needed

0 commit comments

Comments
 (0)