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

Merge pull request #39 from gwinn/release

fix product card
This commit is contained in:
Alex Lushpai 2018-09-14 00:20:30 +03:00 committed by GitHub
commit 9d5b9b1b0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 = "**Заказ"