Fixes in notifyTask
This commit is contained in:
parent
7fba6ddb93
commit
7ac170ce04
|
@ -51,10 +51,14 @@ func TaskNotifyUsers(b *echotron.API) {
|
||||||
text := fmt.Sprintf("*[%s](tg://user?id=%d)*, напоминаю, что тебе необходимо пройти капчу\\!", EscapeText(echotron.MarkdownV2, user.FirstName), user.Id)
|
text := fmt.Sprintf("*[%s](tg://user?id=%d)*, напоминаю, что тебе необходимо пройти капчу\\!", EscapeText(echotron.MarkdownV2, user.FirstName), user.Id)
|
||||||
store.ReplaceItem(ctx, *user, false)
|
store.ReplaceItem(ctx, *user, false)
|
||||||
chat, err := chatStore.GetOne(ctx, tongo.E("chat_id", user.ChatId))
|
chat, err := chatStore.GetOne(ctx, tongo.E("chat_id", user.ChatId))
|
||||||
|
topic := 0
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Can't get chat from user: %s", err)
|
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 {
|
if err != nil {
|
||||||
log.Printf("Can't send notification to user: %s", err)
|
log.Printf("Can't send notification to user: %s", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue