Files
Nexumi/apps/bot/src/modules/guildbackup/command-definitions.ts
TheOnlyMace 8513848440 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.
2026-07-25 15:37:56 +02:00

34 lines
1.4 KiB
TypeScript

import { applyCommandDescription, applyOptionDescription } from '@nexumi/shared';
import { PermissionFlagsBits, SlashCommandBuilder } from 'discord.js';
export const backupCommandData = applyCommandDescription(
new SlashCommandBuilder()
.setName('backup')
.setDefaultMemberPermissions(PermissionFlagsBits.ManageGuild)
.addSubcommand((s) =>
applyCommandDescription(s.setName('create'), 'guildbackup.create.description').addStringOption(
(o) => applyOptionDescription(o.setName('name'), 'guildbackup.create.options.name')
)
)
.addSubcommand((s) => applyCommandDescription(s.setName('list'), 'guildbackup.list.description'))
.addSubcommand((s) =>
applyCommandDescription(s.setName('info'), 'guildbackup.info.description').addStringOption(
(o) =>
applyOptionDescription(o.setName('id').setRequired(true), 'guildbackup.common.options.id')
)
)
.addSubcommand((s) =>
applyCommandDescription(s.setName('delete'), 'guildbackup.delete.description').addStringOption(
(o) =>
applyOptionDescription(o.setName('id').setRequired(true), 'guildbackup.common.options.id')
)
)
.addSubcommand((s) =>
applyCommandDescription(s.setName('restore'), 'guildbackup.restore.description').addStringOption(
(o) =>
applyOptionDescription(o.setName('id').setRequired(true), 'guildbackup.common.options.id')
)
),
'guildbackup.description'
);