feat: improve command handling

LU
6mo ago
+43-17

Summary

Improves command handling with early validation and better error messages, and adds dev environment awareness for command loading.

Changes

  • config.ts: add isProduction getter based on NODE_ENV
  • manager.ts: use isBun || isDev to load commands from src/ in dev environment; add exists() method for early command validation
  • messageCreate.ts: use exists() for early return before building context; distinguish between unknown command and failed execution error messages

Summary by cubic

Improves command handling with early validation and clearer errors, and loads commands from src/ in dev or Bun for faster local development. Adds config.isProduction based on NODE_ENV.

  • New Features

    • Added config.isProduction getter (NODE_ENV === 'production').
    • Command manager loads from src/ in Bun or non‑production; uses dist/ in production Node.
    • Added exists() for early command validation and short-circuiting.
    • Clearer replies: unknown command vs execution failure.
  • Bug Fixes

    • Safely parse content-length with Number(...) in remote upload.
    • Explicit Express typings for app and Router to resolve TS errors.