From d37545f111aee8e25c96effd989972130124c20c Mon Sep 17 00:00:00 2001 From: Nikitin Aleksandr Date: Thu, 21 Nov 2024 10:20:21 +0300 Subject: [PATCH] =?UTF-8?q?=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20EscapeSt?= =?UTF-8?q?ring()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 2 -- telegram_bot/telegram_bot.go | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0d339dee..83fc28eb 100644 --- a/Makefile +++ b/Makefile @@ -24,8 +24,6 @@ build: clear ./make_version.sh go build -race -o $(FILEAPP) $(FILEMAIN) - cd ./cmd && \ - ./VersionToFile.py lint: clear go fmt ./... diff --git a/telegram_bot/telegram_bot.go b/telegram_bot/telegram_bot.go index 6c0992dc..26471682 100644 --- a/telegram_bot/telegram_bot.go +++ b/telegram_bot/telegram_bot.go @@ -8,6 +8,7 @@ import ( "github.com/ManyakRus/starter/micro" "github.com/ManyakRus/starter/stopapp" botapi "github.com/go-telegram-bot-api/telegram-bot-api/v5" + "html" "os" "sync" ) @@ -141,6 +142,10 @@ func SendMessage(UserName string, Text string) (int, error) { var ID int var err error + //экранируем запрещённые символы + Text = html.EscapeString(Text) + + // msg := botapi.NewMessageToChannel(UserName, Text) msg.ParseMode = "HTML"