commit
40269cdf5c
@ -8,7 +8,7 @@ services:
|
|||||||
POSTGRES_PASSWORD: mg_telegram
|
POSTGRES_PASSWORD: mg_telegram
|
||||||
POSTGRES_DATABASE: mg_telegram
|
POSTGRES_DATABASE: mg_telegram
|
||||||
ports:
|
ports:
|
||||||
- ${POSTGRES_ADDRESS:-127.0.0.1:5434}:${POSTGRES_PORT:-5432}
|
- ${POSTGRES_ADDRESS:-127.0.0.1:5432}:${POSTGRES_PORT:-5432}
|
||||||
|
|
||||||
mg_telegram:
|
mg_telegram:
|
||||||
image: golang:1.11-stretch
|
image: golang:1.11-stretch
|
||||||
|
2
go.mod
2
go.mod
@ -45,7 +45,7 @@ require (
|
|||||||
github.com/pkg/errors v0.8.0
|
github.com/pkg/errors v0.8.0
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/retailcrm/api-client-go v1.1.1
|
github.com/retailcrm/api-client-go v1.1.1
|
||||||
github.com/retailcrm/mg-transport-api-client-go v1.1.26
|
github.com/retailcrm/mg-transport-api-client-go v1.1.29
|
||||||
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf // indirect
|
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf // indirect
|
||||||
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a // indirect
|
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a // indirect
|
||||||
github.com/stevvooe/resumable v0.0.0-20180830230917-22b14a53ba50 // indirect
|
github.com/stevvooe/resumable v0.0.0-20180830230917-22b14a53ba50 // indirect
|
||||||
|
4
go.sum
4
go.sum
@ -95,8 +95,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
|||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/retailcrm/api-client-go v1.1.1 h1:yqsyYjBDdmDwExVlTdGucY9/IpEokXpkfTfA6z5AZ7M=
|
github.com/retailcrm/api-client-go v1.1.1 h1:yqsyYjBDdmDwExVlTdGucY9/IpEokXpkfTfA6z5AZ7M=
|
||||||
github.com/retailcrm/api-client-go v1.1.1/go.mod h1:QRoPE2SM6ST7i2g0yEdqm7Iw98y7cYuq3q14Ot+6N8c=
|
github.com/retailcrm/api-client-go v1.1.1/go.mod h1:QRoPE2SM6ST7i2g0yEdqm7Iw98y7cYuq3q14Ot+6N8c=
|
||||||
github.com/retailcrm/mg-transport-api-client-go v1.1.26 h1:eZJOg7jKbsp1Mo8zSPx+XSWLYJ654jsl4zyHstk4DkQ=
|
github.com/retailcrm/mg-transport-api-client-go v1.1.29 h1:C2YMCbRsbyw8jz8Xh6oWK9DFgslcLZYDRjJdZpAMDoE=
|
||||||
github.com/retailcrm/mg-transport-api-client-go v1.1.26/go.mod h1:AWV6BueE28/6SCoyfKURTo4lF0oXYoOKmHTzehd5vAI=
|
github.com/retailcrm/mg-transport-api-client-go v1.1.29/go.mod h1:AWV6BueE28/6SCoyfKURTo4lF0oXYoOKmHTzehd5vAI=
|
||||||
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf h1:6V1qxN6Usn4jy8unvggSJz/NC790tefw8Zdy6OZS5co=
|
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf h1:6V1qxN6Usn4jy8unvggSJz/NC790tefw8Zdy6OZS5co=
|
||||||
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a h1:JSvGDIbmil4Ui/dDdFBExb7/cmkNjyX5F97oglmvCDo=
|
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a h1:JSvGDIbmil4Ui/dDdFBExb7/cmkNjyX5F97oglmvCDo=
|
||||||
|
@ -565,8 +565,8 @@ func telegramWebhookHandler(c *gin.Context) {
|
|||||||
Type: "text",
|
Type: "text",
|
||||||
Text: update.Message.Text,
|
Text: update.Message.Text,
|
||||||
},
|
},
|
||||||
Originator: "user",
|
Originator: v1.OriginatorCustomer,
|
||||||
User: v1.User{
|
Customer: v1.Customer{
|
||||||
ExternalID: strconv.Itoa(update.Message.From.ID),
|
ExternalID: strconv.Itoa(update.Message.From.ID),
|
||||||
Nickname: nickname,
|
Nickname: nickname,
|
||||||
Firstname: update.Message.From.FirstName,
|
Firstname: update.Message.From.FirstName,
|
||||||
@ -776,7 +776,6 @@ func mgWebhookHandler(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.JSON(http.StatusOK, gin.H{})
|
c.JSON(http.StatusOK, gin.H{})
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1013,6 +1012,7 @@ func setAttachment(attachments *tgbotapi.Message, client *v1.MgClient, snd *v1.S
|
|||||||
}
|
}
|
||||||
|
|
||||||
snd.Message.Type = v1.MsgTypeImage
|
snd.Message.Type = v1.MsgTypeImage
|
||||||
|
snd.Message.Note = attachments.Caption
|
||||||
case "document":
|
case "document":
|
||||||
fileID = attachments.Document.FileID
|
fileID = attachments.Document.FileID
|
||||||
snd.Message.Type = v1.MsgTypeFile
|
snd.Message.Type = v1.MsgTypeFile
|
||||||
|
Loading…
Reference in New Issue
Block a user