Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
|
@@ -561,6 +561,16 @@ client.on('messageCreate', async (message) => {
|
|
| 561 |
|
| 562 |
// Interaction Handler
|
| 563 |
client.on('interactionCreate', async (interaction) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 564 |
if (interaction.isChatInputCommand()) {
|
| 565 |
logTransaction(client, interaction.commandName, interaction.user, interaction.guild, interaction.member);
|
| 566 |
|
|
|
|
| 561 |
|
| 562 |
// Interaction Handler
|
| 563 |
client.on('interactionCreate', async (interaction) => {
|
| 564 |
+
// Immediate acknowledgment to prevent "Interaction failed"
|
| 565 |
+
if (interaction.isChatInputCommand() || interaction.isButton() || interaction.isStringSelectMenu() || interaction.isModalSubmit()) {
|
| 566 |
+
try {
|
| 567 |
+
// Only defer if not already handled or if it's a long-running command
|
| 568 |
+
if (interaction.commandName !== 'ping') {
|
| 569 |
+
await interaction.deferReply({ ephemeral: true }).catch(() => {});
|
| 570 |
+
}
|
| 571 |
+
} catch (e) {}
|
| 572 |
+
}
|
| 573 |
+
|
| 574 |
if (interaction.isChatInputCommand()) {
|
| 575 |
logTransaction(client, interaction.commandName, interaction.user, interaction.guild, interaction.member);
|
| 576 |
|