feat: add /settings command and document /history for UI-command parity
- Add /settings command handler with inline settings keyboard - Add /history to README commands table - Update /help command list - Remove unused Leagu.go old reference
This commit is contained in:
@@ -94,6 +94,7 @@ Categorize your work sessions (e.g., Remote, Onsite, Meeting). The current work
|
|||||||
| Command | Action |
|
| Command | Action |
|
||||||
| --------------------------- | ----------------------------------------------------------- |
|
| --------------------------- | ----------------------------------------------------------- |
|
||||||
| `/start` | Show inline menu |
|
| `/start` | Show inline menu |
|
||||||
|
| `/settings` | Open settings menu |
|
||||||
| `/clockin` | Record clock-in |
|
| `/clockin` | Record clock-in |
|
||||||
| `/clockout` | Record clock-out |
|
| `/clockout` | Record clock-out |
|
||||||
| `/worktype` | Change current work type |
|
| `/worktype` | Change current work type |
|
||||||
@@ -101,6 +102,7 @@ Categorize your work sessions (e.g., Remote, Onsite, Meeting). The current work
|
|||||||
| `/dayoff` | Toggle today as day off |
|
| `/dayoff` | Toggle today as day off |
|
||||||
| `/export [YYYY-MM]` | Export monthly report (optional `YYYY-MM` in your calendar) |
|
| `/export [YYYY-MM]` | Export monthly report (optional `YYYY-MM` in your calendar) |
|
||||||
| `/summary [YYYY-MM]` | Show monthly summary (optional `YYYY-MM`) |
|
| `/summary [YYYY-MM]` | Show monthly summary (optional `YYYY-MM`) |
|
||||||
|
| `/history` | View calendar history (inline menu also) |
|
||||||
| `/edit YYYY-MM-DD` | View/edit events for a specific date |
|
| `/edit YYYY-MM-DD` | View/edit events for a specific date |
|
||||||
| `/note [DATE] HH:MM <text>` | Set note for an event at a specific time |
|
| `/note [DATE] HH:MM <text>` | Set note for an event at a specific time |
|
||||||
| `/settimezone <IANA>` | Set timezone (e.g. `Asia/Tehran`) |
|
| `/settimezone <IANA>` | Set timezone (e.g. `Asia/Tehran`) |
|
||||||
|
|||||||
@@ -148,6 +148,8 @@ func (h *Handler) routeCommand(ctx context.Context, msg *models.Message, user *d
|
|||||||
switch cmd {
|
switch cmd {
|
||||||
case "/start":
|
case "/start":
|
||||||
h.handleStart(ctx, msg, user)
|
h.handleStart(ctx, msg, user)
|
||||||
|
case "/settings":
|
||||||
|
h.handleSettings(ctx, msg, user)
|
||||||
case "/help":
|
case "/help":
|
||||||
h.handleHelp(ctx, msg)
|
h.handleHelp(ctx, msg)
|
||||||
case "/clockin":
|
case "/clockin":
|
||||||
|
|||||||
@@ -21,9 +21,21 @@ func (h *Handler) handleStart(ctx context.Context, msg *models.Message, user *do
|
|||||||
h.sendWithKB(ctx, msg.Chat.ID, h.buildStatusText(user), kb)
|
h.sendWithKB(ctx, msg.Chat.ID, h.buildStatusText(user), kb)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *Handler) handleSettings(ctx context.Context, msg *models.Message, user *domain.User) {
|
||||||
|
st, err := h.Repo.GetOrCreateSettings(user.ID)
|
||||||
|
if err != nil {
|
||||||
|
h.sendText(ctx, msg.Chat.ID, "Error loading settings")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
bt := h.getTodayBreakThreshold(user)
|
||||||
|
text, kb := h.buildSettingsKeyboard(user, st, bt)
|
||||||
|
h.sendWithKB(ctx, msg.Chat.ID, text, kb)
|
||||||
|
}
|
||||||
|
|
||||||
func (h *Handler) handleHelp(ctx context.Context, msg *models.Message) {
|
func (h *Handler) handleHelp(ctx context.Context, msg *models.Message) {
|
||||||
text := `Commands:
|
text := `Commands:
|
||||||
/start - Show main menu
|
/start - Show main menu
|
||||||
|
/settings - Open settings
|
||||||
/clockin - Clock in
|
/clockin - Clock in
|
||||||
/clockout - Clock out
|
/clockout - Clock out
|
||||||
/worktype - Select work type
|
/worktype - Select work type
|
||||||
|
|||||||
Reference in New Issue
Block a user