fix tg example
This commit is contained in:
parent
7b482b17bc
commit
f2a74857b7
@ -18,7 +18,7 @@ func RegisterSystem() {
|
||||
AccountURL: AppConfig.BaseURL,
|
||||
Integrations: &retailcrm.Integrations{
|
||||
MgTransport: &retailcrm.MgTransport{
|
||||
WebhookURL: AppConfig.BaseURL + "/api/v1/webhook",
|
||||
WebhookURL: AppConfig.BaseURL + "/api/v1/mg",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
@ -39,10 +39,11 @@ func Listen() {
|
||||
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
|
||||
<-quit
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
log.Println("shutting down, please wait...")
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
||||
defer cancel()
|
||||
if err := srv.Shutdown(ctx); err != nil {
|
||||
log.Fatal("shutting down:", err)
|
||||
log.Fatal("shutdown error:", err)
|
||||
}
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
@ -65,7 +66,7 @@ func MGWebhookHandler(c *gin.Context) {
|
||||
}
|
||||
|
||||
whMsg := wh.MessageWebhookData()
|
||||
if strings.HasPrefix(whMsg.ExternalChatID, ChatIDPrefix) {
|
||||
if !strings.HasPrefix(whMsg.ExternalChatID, ChatIDPrefix) {
|
||||
c.AbortWithStatusJSON(http.StatusUnprocessableEntity,
|
||||
v1.NewTransportErrorResponse(v1.MessageErrorGeneral, "unexpected chat ID"))
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user