1.3 KiB
1.3 KiB
Context & Goal
Currently, every command manually performs checks like user existence or maintenance mode, or these are hardcoded into the CommandHandler. Standardizing these requirements in the command definition itself makes the code cleaner and more declarative.
Dependencies
- None
Affected Files
shared/lib/types.ts: UpdateCommandinterface to include a optionalrequirementsobject.bot/lib/handlers/CommandHandler.ts: Update to read and enforce these requirements.bot/commands/economy/balance.ts: Refactor to use the new requirements (example).
Technical Constraints & Strategy
- Implementation: Use a standardized
requirementsobject in theCommandinterface. - Requirements could include:
userExists: boolean,permissions: string[],devOnly: boolean. - Ensure
CommandHandlerprovides clear error messages to the user when a requirement fails.
Definition of Done (Binary)
Commandinterface updated intypes.ts.CommandHandler.tsenforces requirements before executing command.- At least one command (e.g.,
balance) is refactored to use the new system. - Clear error embeds are shown to the user when requirements aren't met.
New Test Files
- None (Verification via manual testing of command execution).