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) }