Implement command cooldown management and enhance command execution flow
- Introduced `applyCommandCooldown` function to manage per-command cooldowns after execution, improving command rate limiting. - Updated command execution flow to include cooldown application, ensuring users are informed of cooldown status. - Enhanced error handling in interaction replies, allowing for more graceful error management and user feedback. - Improved the handling of interaction responses across various commands, ensuring consistent user experience. - Added permission checks for new commands, ensuring only authorized users can execute specific actions.
This commit is contained in:
@@ -32,17 +32,18 @@ const translateContextMenu: ContextMenuCommand = {
|
||||
return;
|
||||
}
|
||||
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
|
||||
const targetLang = locale === 'de' ? 'de' : 'en';
|
||||
const translated = await translateText(content, targetLang);
|
||||
|
||||
if (!translated) {
|
||||
await interaction.reply({ content: t(locale, 'utility.translate.failed'), ephemeral: true });
|
||||
await interaction.editReply({ content: t(locale, 'utility.translate.failed') });
|
||||
return;
|
||||
}
|
||||
|
||||
await interaction.reply({
|
||||
content: t(locale, 'utility.translate.result').replace('{text}', translated),
|
||||
ephemeral: true
|
||||
await interaction.editReply({
|
||||
content: t(locale, 'utility.translate.result').replace('{text}', translated)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user