Fixed bug with card _____ in Telegram

This commit is contained in:
Artyom Belousov 2021-06-25 13:01:55 +03:00
parent 50353b67cd
commit 310c99eeb6
2 changed files with 9 additions and 1 deletions

View file

@ -2,6 +2,7 @@ package telegram
import (
"fmt"
"strings"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
"gitlab.com/flygrounder/go-mtg-vk/internal/cardsinfo"
@ -24,7 +25,8 @@ func (h *Sender) Send(userId int64, message string) {
}
func formatCardPrices(name string, prices []cardsinfo.ScgCardPrice) string {
message := fmt.Sprintf("Оригинальное название: %v\n\n", name)
escapedName := strings.ReplaceAll(name, "_", "\\_")
message := fmt.Sprintf("Оригинальное название: %v\n\n", escapedName)
for i, v := range prices {
message += fmt.Sprintf("%v. %v", i+1, formatPrice(v))
}