add logs
This commit is contained in:
parent
b052d03fb5
commit
76def36cd1
@ -35,6 +35,7 @@ func NewTelegram(deps Deps) *Telegram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Telegram) SendVerification(data *models.Verification, url string, isUpdate bool) error {
|
func (t *Telegram) SendVerification(data *models.Verification, url string, isUpdate bool) error {
|
||||||
|
fmt.Println("VERT", data, url,isUpdate)
|
||||||
var tplPath string
|
var tplPath string
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
tplPath = UpdatedVerification
|
tplPath = UpdatedVerification
|
||||||
@ -42,14 +43,17 @@ func (t *Telegram) SendVerification(data *models.Verification, url string, isUpd
|
|||||||
tplPath = NewVerification
|
tplPath = NewVerification
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println("VERT1", tplPath)
|
||||||
var userURL string
|
var userURL string
|
||||||
if url == t.stagingURL {
|
if url == t.stagingURL {
|
||||||
userURL = fmt.Sprintf("%s/users/%s", t.stagingURL, data.UserID)
|
userURL = fmt.Sprintf("%s/users/%s", t.stagingURL, data.UserID)
|
||||||
} else {
|
} else {
|
||||||
userURL = fmt.Sprintf("https://admin.pena/users/%s", data.UserID)
|
userURL = fmt.Sprintf("https://admin.pena/users/%s", data.UserID)
|
||||||
}
|
}
|
||||||
|
fmt.Println("VERT2", userURL)
|
||||||
|
|
||||||
tpl, err := template.New("verification_template").Parse(tplPath)
|
tpl, err := template.New("verification_template").Parse(tplPath)
|
||||||
|
fmt.Println("VERT333", tpl,err)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error parsing template: %w", err)
|
return fmt.Errorf("error parsing template: %w", err)
|
||||||
}
|
}
|
||||||
@ -69,12 +73,14 @@ func (t *Telegram) SendVerification(data *models.Verification, url string, isUpd
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = tpl.Execute(&text, toTG)
|
err = tpl.Execute(&text, toTG)
|
||||||
|
fmt.Println("VERT433", err)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error executing template: %w", err)
|
return fmt.Errorf("error executing template: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := tgbotapi.NewMessage(t.chatID, text.String())
|
msg := tgbotapi.NewMessage(t.chatID, text.String())
|
||||||
|
|
||||||
|
fmt.Println("VERT433", err, t.ChatID, test.String())
|
||||||
_, err = t.bot.Send(msg)
|
_, err = t.bot.Send(msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error sending message: %w", err)
|
return fmt.Errorf("error sending message: %w", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user