From 7ac170ce04e9e354059bd0392b88570f549cfdbc Mon Sep 17 00:00:00 2001 From: nefrace Date: Tue, 14 Feb 2023 01:20:21 +0300 Subject: [PATCH] Fixes in notifyTask --- kicker/tasks.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kicker/tasks.go b/kicker/tasks.go index f84dab1..687bbd3 100644 --- a/kicker/tasks.go +++ b/kicker/tasks.go @@ -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) }