1
0
mirror of synced 2024-11-24 20:56:04 +03:00

Merge pull request #75 from Neur0toxine/master

Check message type before updating it
This commit is contained in:
Alex Lushpai 2019-06-13 14:58:35 +03:00 committed by GitHub
commit 7168a4a4da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,9 +11,9 @@ import (
"time" "time"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-telegram-bot-api/telegram-bot-api" tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
"github.com/retailcrm/api-client-go/v5" v5 "github.com/retailcrm/api-client-go/v5"
"github.com/retailcrm/mg-transport-api-client-go/v1" v1 "github.com/retailcrm/mg-transport-api-client-go/v1"
"golang.org/x/image/webp" "golang.org/x/image/webp"
) )
@ -613,6 +613,15 @@ func telegramWebhookHandler(c *gin.Context) {
if update.EditedMessage != nil { if update.EditedMessage != nil {
if update.EditedMessage.Text == "" { if update.EditedMessage.Text == "" {
if getMessageID(update.EditedMessage) != "undefined" {
if config.Debug {
logger.Debug(b.Token, update.EditedMessage, "Only text messages can be updated")
}
c.JSON(http.StatusOK, gin.H{})
return
}
setLocale(update.EditedMessage.From.LanguageCode) setLocale(update.EditedMessage.From.LanguageCode)
update.EditedMessage.Text = getLocalizedMessage(getMessageID(update.Message)) update.EditedMessage.Text = getLocalizedMessage(getMessageID(update.Message))
} }