1
0
mirror of synced 2024-11-26 21:56: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":
var mb string
if msg.Data.Type == v1.MsgTypeProduct {
mb = fmt.Sprintf(
"[%s](%s)",
msg.Data.Product.Name,
msg.Data.Product.Url,
)
mb = fmt.Sprintf("%s\n", msg.Data.Product.Name)
if msg.Data.Product.Cost != nil && msg.Data.Product.Cost.Value != 0 {
mb += fmt.Sprintf(
"\n%v %s",
"\n%v %s\n",
msg.Data.Product.Cost.Value,
currency[strings.ToLower(msg.Data.Product.Cost.Currency)],
)
}
if msg.Data.Product.Img != "" {
mb = fmt.Sprintf("\n%s", msg.Data.Product.Img)
if msg.Data.Product.Url != "" {
mb += msg.Data.Product.Url
} else {
mb += msg.Data.Product.Img
}
} else if msg.Data.Type == v1.MsgTypeOrder {
mb = "**Заказ"