!timer command creates countdown timers that notify you when time’s up. Perfect for cooking, workouts, study sessions, and any activity where you need a countdown.
Subcommands
Start a Timer
Create a new countdown timer.Duration Formats
| Format | Description | Example |
|---|---|---|
30m | Minutes only | 30 minutes |
1h | Hours only | 60 minutes |
2h30m | Hours + minutes | 150 minutes |
30 | Plain number | 30 minutes (default) |
From TimerHandler.ts:5-8, plain numbers are automatically interpreted as minutes:
Examples
30-minute timer:List Active Timers
View all your running timers with remaining time.No Active Timers
Remaining time is calculated dynamically from the stored end time (TimerHandler.ts:86-88):
Cancel a Timer
Stop and remove an active timer.The timer number from the
!timer list outputComplete Workflow
Common Use Cases
Pomodoro Technique
Cooking
Workout Intervals
Study Sessions
Parameters
Create a new timer.Required: Duration (minutes, hours, or combination)Example:
!timer start 30mDisplay all active timers with remaining time.Arguments: NoneExample:
!timer listStop and delete a timer.Required: Timer number (from list)Example:
!timer cancel 1Error Handling
No Subcommand
Missing Duration
Invalid Duration Format
Exceeds Maximum
Invalid Timer Number
Unknown Subcommand
Implementation Details
Time Parsing
From TimerHandler.ts:4-24, the parser handles multiple formats:Timer Storage
Timers are stored in the database with:- User ID (sender)
- End time (calculated as current time + duration)
- ID for reference
Remaining Time Calculation
The list command calculates remaining minutes dynamically (TimerHandler.ts:85-90):Can I run multiple timers at once?
Can I run multiple timers at once?
Yes! You can have multiple timers running simultaneously. Each timer operates independently, and you can view them all with
!timer list.What happens when a timer expires?
What happens when a timer expires?
The TimerService sends you a WhatsApp notification when the timer reaches zero. The timer is then automatically removed from your active timers list.
Can I pause a timer?
Can I pause a timer?
The current implementation doesn’t support pausing. You can cancel and restart if needed:
Are timers private?
Are timers private?
Yes, timers are associated with your user ID (sender), so they’re private to you. Other users can’t see or modify your timers.
Do timers survive if the bot restarts?
Do timers survive if the bot restarts?
This depends on the TimerService implementation. If timers are stored in a persistent database, they should survive restarts. Check the service implementation for details.