Brozy123 commited on
Commit
41a06b2
·
verified ·
1 Parent(s): c2ef2fd

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +12 -0
index.js CHANGED
@@ -567,6 +567,18 @@ client.on('messageCreate', async (message) => {
567
  }
568
  });
569
 
 
 
 
 
 
 
 
 
 
 
 
 
570
  // Interaction Handler
571
  client.on('interactionCreate', async (interaction) => {
572
  // Immediate acknowledgment to prevent "Interaction failed"
 
567
  }
568
  });
569
 
570
+ async function safeReply(interaction, options) {
571
+ try {
572
+ if (interaction.deferred || interaction.replied) {
573
+ return await interaction.editReply(options);
574
+ } else {
575
+ return await interaction.reply(options);
576
+ }
577
+ } catch (e) {
578
+ console.error(`[!] Reply Failed: ${e.message}`);
579
+ }
580
+ }
581
+
582
  // Interaction Handler
583
  client.on('interactionCreate', async (interaction) => {
584
  // Immediate acknowledgment to prevent "Interaction failed"