From 5b5d99f7b123494ca32c85f37bc98572c2250eea Mon Sep 17 00:00:00 2001 From: Denozordec Date: Mon, 9 Mar 2026 17:43:05 +0700 Subject: [PATCH] Enhance user creation response in main.go to fetch and display user links if not provided by API, with a fallback message for missing links. --- main.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index d456735..ba1da31 100644 --- a/main.go +++ b/main.go @@ -350,9 +350,20 @@ func (b *bot) handleCreateUser(ctx context.Context, chatID int64, text string) e return b.sendMessage(ctx, chatID, "Ошибка создания пользователя: "+err.Error()) } + links := created.User.Links + if len(links.Classic) == 0 && len(links.Secure) == 0 && len(links.TLS) == 0 { + var fetched userInfo + path := "/v1/users/" + url.PathEscape(created.User.Username) + if err := b.callTelemt(ctx, path, &fetched); err == nil { + links = fetched.Links + } + } + msg := fmt.Sprintf("Пользователь создан: %s\nsecret: %s", created.User.Username, created.Secret) - if linksText := formatUserLinks(created.User.Links); linksText != "" { + if linksText := formatUserLinks(links); linksText != "" { msg = msg + "\n\nСсылки:\n" + linksText + } else { + msg = msg + "\n\nСсылки не вернулись из API." } return b.sendMessage(ctx, chatID, msg) }