Resolve monitoring PF bot deep links
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 35s

This commit is contained in:
Grendgi
2026-06-05 10:40:42 +03:00
parent 82782223ba
commit 54cc9372af
2 changed files with 59 additions and 5 deletions

View File

@@ -66,9 +66,15 @@ func (s Server) accessMe(w http.ResponseWriter, r *http.Request) {
writeError(w, http.StatusInternalServerError, err.Error())
return
}
botUsername := s.App.Cfg.TGBotUsername
if botUsername == "" {
if resolved, err := s.App.TG.BotUsername(r.Context()); err == nil {
botUsername = resolved
}
}
var link *string
if s.App.Cfg.TGBotUsername != "" && portalID != "" {
v := "https://t.me/" + s.App.Cfg.TGBotUsername + "?start=" + portalID
if botUsername != "" && portalID != "" {
v := "https://t.me/" + botUsername + "?start=" + portalID
link = &v
}
var command *string
@@ -81,7 +87,7 @@ func (s Server) accessMe(w http.ResponseWriter, r *http.Request) {
"portal_user_id": nullablePlain(portalID),
"telegram_linked": emp != nil && emp.TGChatID != nil && *emp.TGChatID != "",
"employee": emp,
"telegram_bot_username": nullablePlain(s.App.Cfg.TGBotUsername),
"telegram_bot_username": nullablePlain(botUsername),
"telegram_start_command": command,
"telegram_start_link": link,
})