From da22d0135af74f6ed57e1b26bf769b1ea3b921bb Mon Sep 17 00:00:00 2001 From: romanskijdev Date: Wed, 24 Jun 2026 17:16:35 +0300 Subject: [PATCH] notify users --- .../telegram_service/common/update/0_init.go | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/service/telegram_service/common/update/0_init.go b/service/telegram_service/common/update/0_init.go index 1d955ab..5155fff 100644 --- a/service/telegram_service/common/update/0_init.go +++ b/service/telegram_service/common/update/0_init.go @@ -40,7 +40,7 @@ func NewUpdateHandler(ipc *types.InternalProviderControl) *UpdateHandler { // TODO: вызывается только после обновлений //go handler.broadcastBotUpdated() - go handler.broadcastBotMessage() + go handler.sendSupportNotification() return handler } @@ -80,7 +80,7 @@ func (s *UpdateHandler) broadcastBotUpdated() { logrus.Infof("broadcastBotUpdated: отправлено %d пользователям", len(users)) } -func (s *UpdateHandler) broadcastBotMessage() { +func (s *UpdateHandler) sendSupportNotification() { ctx := context.Background() bot := s.ipc.TGBotClient.Bot() @@ -90,11 +90,18 @@ func (s *UpdateHandler) broadcastBotMessage() { return } - text := "Привет! 👋 \n\n" + - "Я твой новый помощник для согласования большинства рабочих вопросов. \n" + - "Во мне предусмотрены все чаты согласований, которые ранее использовались в компании. \n" + - "Пожалуйста, создавай все заявки на согласование вместе со мной. 🤝 \n" + - "Иначе мне будет очень грустно и одиноко 😢, а заявки, скорее всего, не будут рассмотрены. \n" + // Твой строгий и дружелюбный текст с форматированием + text := "❓ Не удается согласовать заявку?\n\n" + + "Пожалуйста, обратитесь в технический отдел к Роману Заболотскому (@bananskij).\n" + + "Скорее всего, он сможет быстро решить твою проблему или ответить на вопрос." + + romaTGURL := "https://t.me/banankij" + + keyboard := tgbotapi.NewInlineKeyboardMarkup( + tgbotapi.NewInlineKeyboardRow( + tgbotapi.NewInlineKeyboardButtonURL("👨‍💻 Написать сообщение", romaTGURL), + ), + ) for _, user := range users { if user.TelegramID == nil { @@ -102,11 +109,13 @@ func (s *UpdateHandler) broadcastBotMessage() { } msg := tgbotapi.NewMessage(*user.TelegramID, text) msg.ParseMode = "HTML" + msg.ReplyMarkup = keyboard if _, err := bot.Send(msg); err != nil { logrus.Warnf("broadcastBotUpdated: Send to telegramID=%d err=%v", *user.TelegramID, err) } time.Sleep(50 * time.Millisecond) } - logrus.Infof("broadcastBotUpdated: отправлено %d пользователям", len(users)) + logrus.Infof("sendSupportNotification: отправлено %d пользователям", len(users)) + } -- 2.43.0