1
0
mirror of synced 2024-11-27 06:06:02 +03:00

fix markdown

This commit is contained in:
Alex Lushpai 2018-09-14 00:26:21 +03:00
parent 9d5b9b1b0a
commit 4565419463

View File

@ -513,7 +513,7 @@ func mgWebhookHandler(c *gin.Context) {
mb += msg.Data.Product.Img mb += msg.Data.Product.Img
} }
} else if msg.Data.Type == v1.MsgTypeOrder { } else if msg.Data.Type == v1.MsgTypeOrder {
mb = "**Заказ" mb = "Заказ"
if msg.Data.Order.Number != "" { if msg.Data.Order.Number != "" {
mb += " " + msg.Data.Order.Number mb += " " + msg.Data.Order.Number
@ -523,7 +523,7 @@ func mgWebhookHandler(c *gin.Context) {
mb += fmt.Sprintf(" (%s)", msg.Data.Order.Date) mb += fmt.Sprintf(" (%s)", msg.Data.Order.Date)
} }
mb += "**\n" mb += "\n"
if len(msg.Data.Order.Items) > 0 { if len(msg.Data.Order.Items) > 0 {
for _, v := range msg.Data.Order.Items { for _, v := range msg.Data.Order.Items {
mb += fmt.Sprintf("%s %v x %v %s\n", v.Name, v.Quantity.Value, v.Price.Value, currency[strings.ToLower(v.Price.Currency)]) mb += fmt.Sprintf("%s %v x %v %s\n", v.Name, v.Quantity.Value, v.Price.Value, currency[strings.ToLower(v.Price.Currency)])
@ -536,10 +536,6 @@ func mgWebhookHandler(c *gin.Context) {
} }
m := tgbotapi.NewMessage(cid, mb) m := tgbotapi.NewMessage(cid, mb)
if msg.Data.Type == v1.MsgTypeProduct || msg.Data.Type == v1.MsgTypeOrder {
m.ParseMode = "Markdown"
}
if msg.Data.QuoteExternalID != "" { if msg.Data.QuoteExternalID != "" {
qid, err := strconv.Atoi(msg.Data.QuoteExternalID) qid, err := strconv.Atoi(msg.Data.QuoteExternalID)
if err != nil { if err != nil {