Added different formatting for telegram bot

This commit is contained in:
Artyom Belousov 2021-06-06 17:21:29 +03:00
parent 35f8fa5a57
commit 89623f5f6a
18 changed files with 233 additions and 173 deletions

22
internal/vk/format.go Normal file
View file

@ -0,0 +1,22 @@
package vk
import (
"fmt"
"gitlab.com/flygrounder/go-mtg-vk/internal/cardsinfo"
)
func formatCardPrices(name string, prices []cardsinfo.ScgCardPrice) string {
message := fmt.Sprintf("Оригинальное название: %v\n\n", name)
for i, v := range prices {
message += fmt.Sprintf("%v. %v", i+1, formatPrice(v))
}
if len(prices) == 0 {
message += "Цен не найдено\n"
}
return message
}
func formatPrice(s cardsinfo.ScgCardPrice) string {
return fmt.Sprintf("%v: %v\n%v\n", s.Edition, s.Price, s.Link)
}