Skip to content

[Reviewed] refactor(commands): update commands path and enhance uptime command#24

Open
Abmarne wants to merge 1 commit into
IN3PIRE:mainfrom
Abmarne:main
Open

[Reviewed] refactor(commands): update commands path and enhance uptime command#24
Abmarne wants to merge 1 commit into
IN3PIRE:mainfrom
Abmarne:main

Conversation

@Abmarne
Copy link
Copy Markdown

@Abmarne Abmarne commented Apr 29, 2026

Fixes: #20

Changes Made:

  1. Enhanced uptime.js:

    • ✅ Displays human-readable uptime with days, hours, minutes, and seconds
    • ✅ Shows process ID in an inline field
    • ✅ Shows memory usage (heap used in MB) in an inline field
    • ✅ Uses green color scheme (0x00FFAB)
    • ✅ Includes user avatar in footer with timestamp
    • ✅ Proper error handling with ephemeral error messages
    • ✅ Direct reply (no deferReply needed for this simple command)
  2. Fixed deploy-commands.js:

    • ✅ Changed command path from commands to slashcommands to match the actual directory structure

Features:

  • Dynamic uptime calculation: Shows only relevant time units (e.g., "2 days, 5 hours, 30 minutes")
  • Process information: Displays the Node.js process ID
  • Memory monitoring: Shows heap memory usage in MB
  • User attribution: Footer shows who requested the command with their avatar
  • Professional embed: Clean formatting with emoji and proper color scheme

- Change commands directory from 'commands' to 'slashcommands' for consistency
- Refactor uptime command to display uptime with days, hours, minutes, and seconds
- Add process ID and memory usage information to uptime embed
- Improve uptime message formatting with pluralization and styling
- Replace deferred reply with immediate reply in uptime command execution
Copy link
Copy Markdown
Contributor

@TrivCodez TrivCodez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's working well

  • Path fix is correct: commandsslashcommands matches actual directory structure
  • Time formatting: dynamic units with proper pluralization, clean join()
  • Embed polish: emoji title, green color, user footer with avatar, timestamp
  • Diagnostics: PID and heap usage inline fields give good ops visibility
  • Error handling: ephemeral reply on catch, removed unnecessary deferReply

Issues

Blocking

  • src/deploy-commands.js:7 reads directory without existence check. If slashcommands is missing, it throws. Should wrap fs.readdirSync() in try/catch or add fs.existsSync() guard (see PR #23 for same issue).

Verdict

Good to merge once path safety is addressed. Add try/catch around fs.readdirSync() or an existence check to match defensive patterns used elsewhere.

@TrivCodez TrivCodez changed the title refactor(commands): update commands path and enhance uptime command [Reviewed] refactor(commands): update commands path and enhance uptime command Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add /uptime command to display bot uptime

2 participants