Skip to content

feat: add !uptime prefix command + improve DISCORD_TOKEN error message#12

Merged
TrivCodez merged 4 commits into
IN3PIRE:mainfrom
Ghraven:feat/uptime-command
Apr 28, 2026
Merged

feat: add !uptime prefix command + improve DISCORD_TOKEN error message#12
TrivCodez merged 4 commits into
IN3PIRE:mainfrom
Ghraven:feat/uptime-command

Conversation

@Ghraven
Copy link
Copy Markdown
Contributor

@Ghraven Ghraven commented Apr 27, 2026

Closes #9
Closes #7

What

1. !uptime command (prefixcommands/uptime.py)

  • Records bot start time when the cog loads using datetime.now(timezone.utc)
  • Calculates elapsed days, hours, minutes, seconds
  • Outputs human-readable string e.g. Bot Uptime: 2 days, 14 hours, 35 minutes
  • Omits zero-value leading units (shows seconds only if uptime < 1 minute)
  • Follows exact same pattern as prefixcommands/ping.py (Cog class + type hints)
  • Works in both guilds and DMs

2. Better DISCORD_TOKEN error (bot.py)

  • Replaces the generic one-liner RuntimeError with a clear 3-step message
  • Tells users exactly what to do: copy .env.example, fill in token, link to Discord dev portal
  • Also registers prefixcommands.uptime in the extensions list

Example output

!uptime
Bot Uptime: 1 day, 3 hours, 22 minutes

Files changed

  • prefixcommands/uptime.py — new file
  • bot.py — register uptime extension + improve token error message

Ghraven added 3 commits April 27, 2026 19:11
Closes IN3PIRE#11

Pins discord.py and python-dotenv to exact versions (==) to prevent
accidental breakage from upstream updates, and adds inline comments
explaining each package's role.
@TrivCodez
Copy link
Copy Markdown
Contributor

PR Review

Status: ✅ Code Approved, ⚠️ Scope Note, ⏳ Awaiting Star

✅ Quality

  • Excellent type hints & patterns
  • Clean uptime formatting
  • Clear error messages
  • Follows existing style

⚠️ Scope Note

PR addresses multiple issues (#9 + #7). Future: one issue per PR for cleaner history.

⛔ Requirements Check

Missing: Repository Star

@Ghraven — You must ⭐ star this repository before merge.

Action: Click ⭐ at https://github.com/IN3PIRE/pn then comment here.

📝 Next Steps

Once starred → merge. Code is production-ready despite scope.


Review includes star verification requirement

@Ghraven
Copy link
Copy Markdown
Contributor Author

Ghraven commented Apr 28, 2026

Thanks for the thorough review, @TrivCodez! Really appreciate the kind words on the code quality.

I've gone ahead and starred the repository ⭐ — happy to support the project!

Noted on the scope point too — going forward I'll keep PRs focused on a single issue. Good habit to build.

@TrivCodez TrivCodez merged commit 92a6b0c into IN3PIRE:main Apr 28, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add !uptime prefix command to display bot runtime Improve error handling for missing DISCORD_TOKEN

2 participants