Brozy123 commited on
Commit
c2ae8d6
·
verified ·
1 Parent(s): 7dc99ae

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +10 -0
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