From 7b3a7ac4015ea1c39b89efa8b7671b66a72c157d Mon Sep 17 00:00:00 2001 From: romanskijdev Date: Tue, 7 Jul 2026 13:28:18 +0300 Subject: [PATCH 1/2] Added update message --- .../telegram_service/common/update/0_init.go | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/service/telegram_service/common/update/0_init.go b/service/telegram_service/common/update/0_init.go index fe63bec..7aba153 100644 --- a/service/telegram_service/common/update/0_init.go +++ b/service/telegram_service/common/update/0_init.go @@ -122,3 +122,47 @@ func (s *UpdateHandler) sendNewSupportContactNotification() { logrus.Infof("sendNewSupportContactNotification: отправлено %d пользователям", len(users)) } + +// broadcastCommentsFeatureUpdate уведомляет всех пользователей о новой функции комментариев. +func (s *UpdateHandler) broadcastCommentsFeatureUpdate() { + ctx := context.Background() + bot := s.ipc.TGBotClient.Bot() + + users, _, err := s.ipc.Database.User.GetUsersListDB(ctx, typescore.ListDbOptions{}) + if err != nil { + logrus.Errorf("broadcastCommentsFeatureUpdate: GetUsersListDB err=%v", err) + return + } + + text := "🆕 Что нового в системе согласований\n\n" + + "Мы обновили работу с комментариями - теперь заявка стала похожа на общий чат:\n\n" + + "💬 Комментарии видят все участники\n" + + "Инициатор, согласующий, доп. согласующие, исполнители и наблюдатели теперь получают комментарии друг друга и могут сразу ответить.\n\n" + + "📋 Кнопка «Посмотреть все комментарии» в каждой карточке\n" + + "На карточке заявки сразу видно, сколько комментариев уже оставлено - можно открыть полную историю в один клик.\n\n" + + "Нажмите кнопку ниже, чтобы перезапустить бота:" + + keyboard := tgbotapi.NewInlineKeyboardMarkup( + tgbotapi.NewInlineKeyboardRow( + tgbotapi.NewInlineKeyboardButtonData("🚀 Перезапустить бота", "restart_bot"), + ), + ) + + sent := 0 + for _, user := range users { + if user.TelegramID == nil { + continue + } + msg := tgbotapi.NewMessage(*user.TelegramID, text) + msg.ParseMode = "HTML" + msg.ReplyMarkup = keyboard + if _, err := bot.Send(msg); err != nil { + logrus.Warnf("broadcastCommentsFeatureUpdate: Send to telegramID=%d err=%v", *user.TelegramID, err) + continue + } + sent++ + time.Sleep(50 * time.Millisecond) + } + + logrus.Infof("broadcastCommentsFeatureUpdate: отправлено %d из %d пользователям", sent, len(users)) +} -- 2.43.0 From 003e9fe0c2363504aa2da8abbbf323ee05274a5e Mon Sep 17 00:00:00 2001 From: romanskijdev Date: Tue, 7 Jul 2026 13:28:54 +0300 Subject: [PATCH 2/2] Added update message --- service/telegram_service/common/update/0_init.go | 1 + 1 file changed, 1 insertion(+) diff --git a/service/telegram_service/common/update/0_init.go b/service/telegram_service/common/update/0_init.go index 7aba153..9f5e783 100644 --- a/service/telegram_service/common/update/0_init.go +++ b/service/telegram_service/common/update/0_init.go @@ -41,6 +41,7 @@ func NewUpdateHandler(ipc *types.InternalProviderControl) *UpdateHandler { // TODO: вызывается только после обновлений //go handler.broadcastBotUpdated() //go handler.sendNewSupportContactNotification() + go handler.broadcastCommentsFeatureUpdate() return handler } -- 2.43.0