Files
aurorabot/.agent/work/tickets/001-refactor-command-validation.md
2026-01-14 16:10:23 +01:00

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: Update Command interface to include a optional requirements object.
  • 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 requirements object in the Command interface.
  • Requirements could include: userExists: boolean, permissions: string[], devOnly: boolean.
  • Ensure CommandHandler provides clear error messages to the user when a requirement fails.

Definition of Done (Binary)

  • Command interface updated in types.ts.
  • CommandHandler.ts enforces 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).