Spaces:
Runtime error
Runtime error
Update index.js
Browse files
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"
|