Description
Create a prefix command !uptime that shows how long the bot has been running since its last restart.
Task
- Create
prefixcommands/uptime.py
- Track bot start time using
time.time() or datetime
- Calculate elapsed time (days, hours, minutes, seconds)
- Format output as:
Uptime: X days, Y hours, Z minutes
- Follow existing pattern from
prefixcommands/ping.py
Why this is good for beginners
- Teaches time calculation and formatting
- Introduces global state management
- Simple math operations
- Builds on existing command patterns
- Immediate visual feedback
Example output
Bot Uptime: 2 days, 14 hours, 35 minutes
Files to modify
- Create:
prefixcommands/uptime.py
- Modify:
bot.py (add start_time variable and extension)
Acceptance Criteria
Description
Create a prefix command
!uptimethat shows how long the bot has been running since its last restart.Task
prefixcommands/uptime.pytime.time()ordatetimeUptime: X days, Y hours, Z minutesprefixcommands/ping.pyWhy this is good for beginners
Example output
Files to modify
prefixcommands/uptime.pybot.py(add start_time variable and extension)Acceptance Criteria
!uptime