Compare commits
2 Commits
6f7f5878bf
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
bddb920c82
|
|||
|
2c1c149b13
|
@@ -445,6 +445,12 @@ func (h *Handler) handleSetRate(ctx context.Context, msg *models.Message, user *
|
||||
return
|
||||
}
|
||||
h.saveRate(ctx, msg.Chat.ID, user, rate)
|
||||
st, _ := h.Repo.GetOrCreateSettings(user.ID)
|
||||
sym := "$"
|
||||
if st != nil && st.Currency != "" {
|
||||
sym = domain.CurrencySymbol(st.Currency)
|
||||
}
|
||||
h.sendText(ctx, msg.Chat.ID, fmt.Sprintf("Hourly rate set to %s%.2f", sym, rate))
|
||||
}
|
||||
|
||||
func (h *Handler) handleSetCurrency(ctx context.Context, msg *models.Message, user *domain.User) {
|
||||
@@ -460,6 +466,7 @@ func (h *Handler) handleSetCurrency(ctx context.Context, msg *models.Message, us
|
||||
return
|
||||
}
|
||||
h.saveCurrency(ctx, msg.Chat.ID, user, currency)
|
||||
h.sendText(ctx, msg.Chat.ID, fmt.Sprintf("Currency set to: %s", currency))
|
||||
}
|
||||
|
||||
func (h *Handler) handleSetTimezone(ctx context.Context, msg *models.Message, user *domain.User) {
|
||||
@@ -474,6 +481,9 @@ func (h *Handler) handleSetTimezone(ctx context.Context, msg *models.Message, us
|
||||
return
|
||||
}
|
||||
h.saveTimezone(ctx, msg.Chat.ID, user, args)
|
||||
loc := h.loadLocation(args)
|
||||
now := time.Now().In(loc).Format(domain.TimeLayout)
|
||||
h.sendText(ctx, msg.Chat.ID, fmt.Sprintf("Timezone set to %s (current time: %s)", args, now))
|
||||
}
|
||||
|
||||
func (h *Handler) handleSetBreak(ctx context.Context, msg *models.Message, user *domain.User) {
|
||||
@@ -489,6 +499,7 @@ func (h *Handler) handleSetBreak(ctx context.Context, msg *models.Message, user
|
||||
return
|
||||
}
|
||||
h.saveBreakThreshold(ctx, msg.Chat.ID, user, mins)
|
||||
h.sendText(ctx, msg.Chat.ID, fmt.Sprintf("Break threshold set to %d minutes.", mins))
|
||||
}
|
||||
|
||||
func (h *Handler) handleSetUsername(ctx context.Context, msg *models.Message, user *domain.User) {
|
||||
@@ -499,6 +510,7 @@ func (h *Handler) handleSetUsername(ctx context.Context, msg *models.Message, us
|
||||
return
|
||||
}
|
||||
h.saveUsername(ctx, msg.Chat.ID, user, name)
|
||||
h.sendText(ctx, msg.Chat.ID, fmt.Sprintf("Username set to: %s", name))
|
||||
}
|
||||
|
||||
func (h *Handler) handleSetReportTime(ctx context.Context, msg *models.Message, user *domain.User) {
|
||||
@@ -515,7 +527,9 @@ func (h *Handler) handleSetReportTime(ctx context.Context, msg *models.Message,
|
||||
}
|
||||
if err := h.validateAndSaveReportTime(ctx, msg.Chat.ID, user, args); err != nil {
|
||||
h.sendText(ctx, msg.Chat.ID, err.Error())
|
||||
return
|
||||
}
|
||||
h.sendText(ctx, msg.Chat.ID, fmt.Sprintf("Report time set to %s", args))
|
||||
}
|
||||
|
||||
func (h *Handler) handleSetAccent(ctx context.Context, msg *models.Message, user *domain.User) {
|
||||
@@ -562,8 +576,13 @@ func (h *Handler) processRateInput(ctx context.Context, msg *models.Message, use
|
||||
}
|
||||
h.saveRate(ctx, msg.Chat.ID, user, rate)
|
||||
backKB := settingsBackKeyboard()
|
||||
st, _ := h.Repo.GetOrCreateSettings(user.ID)
|
||||
sym := "$"
|
||||
if st != nil && st.Currency != "" {
|
||||
sym = domain.CurrencySymbol(st.Currency)
|
||||
}
|
||||
h.editText(ctx, msg.Chat.ID, pi.MsgID,
|
||||
fmt.Sprintf("Hourly rate set to %s%.2f", domain.CurrencySymbol(""), rate), &backKB)
|
||||
fmt.Sprintf("Hourly rate set to %s%.2f", sym, rate), &backKB)
|
||||
}
|
||||
|
||||
func (h *Handler) processCurrencyInput(ctx context.Context, msg *models.Message, user *domain.User, pi *PendingInput, text string) {
|
||||
|
||||
Reference in New Issue
Block a user