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:
@@ -53,6 +53,8 @@ export async function executeBan(
|
||||
}
|
||||
}
|
||||
|
||||
await interaction.deferUpdate();
|
||||
|
||||
await guild.members.ban(payload.userId, { reason: payload.reason });
|
||||
const modCase = await createCase(context, {
|
||||
guildId: guild.id,
|
||||
@@ -73,7 +75,7 @@ export async function executeBan(
|
||||
await scheduleTempBanExpire(guild.id, payload.userId, durationMs, payload.reason);
|
||||
}
|
||||
|
||||
await interaction.update({
|
||||
await interaction.editReply({
|
||||
content: tf(locale, 'moderation.success.case', { caseNumber: modCase.caseNumber }),
|
||||
components: []
|
||||
});
|
||||
@@ -91,6 +93,8 @@ export async function executePurge(
|
||||
return;
|
||||
}
|
||||
|
||||
await interaction.deferUpdate();
|
||||
|
||||
const channel = await guild.channels.fetch(payload.channelId);
|
||||
let deletedCount = 0;
|
||||
const regex = payload.regex ? new RegExp(payload.regex, 'i') : null;
|
||||
@@ -134,7 +138,7 @@ export async function executePurge(
|
||||
}
|
||||
});
|
||||
|
||||
await interaction.update({
|
||||
await interaction.editReply({
|
||||
content: tf(locale, 'moderation.purge.done', {
|
||||
deletedCount,
|
||||
caseNumber: modCase.caseNumber
|
||||
|
||||
Reference in New Issue
Block a user