Fixes in notifyTask

This commit is contained in:
nefrace 2023-02-14 01:20:21 +03:00
parent 7fba6ddb93
commit 7ac170ce04
1 changed files with 5 additions and 1 deletions

View File

@ -51,10 +51,14 @@ func TaskNotifyUsers(b *echotron.API) {
text := fmt.Sprintf("*[%s](tg://user?id=%d)*, напоминаю, что тебе необходимо пройти капчу\\!", EscapeText(echotron.MarkdownV2, user.FirstName), user.Id)
store.ReplaceItem(ctx, *user, false)
chat, err := chatStore.GetOne(ctx, tongo.E("chat_id", user.ChatId))
topic := 0
if err != nil {
log.Printf("Can't get chat from user: %s", err)
return
} else {
topic = int(chat.TopicId)
}
res, err := b.SendMessage(text, user.ChatId, &echotron.MessageOptions{MessageThreadID: int(chat.TopicId), ParseMode: echotron.MarkdownV2})
res, err := b.SendMessage(text, user.ChatId, &echotron.MessageOptions{MessageThreadID: topic, ParseMode: echotron.MarkdownV2})
if err != nil {
log.Printf("Can't send notification to user: %s", err)
}