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

fix product card

This commit is contained in:
Alex Lushpai 2018-09-14 00:19:19 +03:00
parent 28cbdf0344
commit 6a5c6c7f5b

View File

@ -497,23 +497,21 @@ func mgWebhookHandler(c *gin.Context) {
case "message_sent": case "message_sent":
var mb string var mb string
if msg.Data.Type == v1.MsgTypeProduct { if msg.Data.Type == v1.MsgTypeProduct {
mb = fmt.Sprintf( mb = fmt.Sprintf("%s\n", msg.Data.Product.Name)
"[%s](%s)",
msg.Data.Product.Name,
msg.Data.Product.Url,
)
if msg.Data.Product.Cost != nil && msg.Data.Product.Cost.Value != 0 { if msg.Data.Product.Cost != nil && msg.Data.Product.Cost.Value != 0 {
mb += fmt.Sprintf( mb += fmt.Sprintf(
"\n%v %s", "\n%v %s\n",
msg.Data.Product.Cost.Value, msg.Data.Product.Cost.Value,
currency[strings.ToLower(msg.Data.Product.Cost.Currency)], currency[strings.ToLower(msg.Data.Product.Cost.Currency)],
) )
} }
if msg.Data.Product.Img != "" { if msg.Data.Product.Url != "" {
mb = fmt.Sprintf("\n%s", msg.Data.Product.Img) mb += msg.Data.Product.Url
} else {
mb += msg.Data.Product.Img
} }
} else if msg.Data.Type == v1.MsgTypeOrder { } else if msg.Data.Type == v1.MsgTypeOrder {
mb = "**Заказ" mb = "**Заказ"