/start command

This commit is contained in:
Stephan D
2026-03-04 23:01:21 +01:00
parent b6f05f52dc
commit e80cb3eed1
2 changed files with 68 additions and 2 deletions

View File

@@ -14,7 +14,8 @@ import (
"go.uber.org/zap"
)
const unauthorizedMessage = "Access denied.\n\nYour Telegram account is not authorized to perform treasury operations."
const unauthorizedMessage = "Sorry, your Telegram account is not authorized to perform treasury operations."
const welcomeMessage = "Welcome to tgsettle treasury bot.\n\nUse /fund to credit your account and /withdraw to debit it.\nAfter entering an amount, use /confirm or /cancel."
type SendTextFunc func(ctx context.Context, chatID string, text string) error
@@ -131,6 +132,9 @@ func (r *Router) HandleUpdate(ctx context.Context, update *model.TelegramWebhook
command := parseCommand(text)
switch command {
case "start":
_ = r.sendText(ctx, chatID, welcomeMessage)
return true
case "fund":
r.startAmountDialog(ctx, userID, accountID, chatID, storagemodel.TreasuryOperationFund)
return true
@@ -158,7 +162,7 @@ func (r *Router) HandleUpdate(ctx context.Context, update *model.TelegramWebhook
}
if strings.HasPrefix(text, "/") {
_ = r.sendText(ctx, chatID, "Supported commands:\n/fund\n/withdraw\n/confirm\n/cancel")
_ = r.sendText(ctx, chatID, "Supported commands:\n/start\n/fund\n/withdraw\n/confirm\n/cancel")
return true
}
return false