Process only text messages from Telegram
This commit is contained in:
parent
b6f48255ef
commit
d56f97052b
@ -84,6 +84,7 @@ func telegramWebhookHandler(w http.ResponseWriter, r *http.Request, token string
|
|||||||
var client = v1.New(c.MGURL, c.MGToken)
|
var client = v1.New(c.MGURL, c.MGToken)
|
||||||
|
|
||||||
if update.Message != nil {
|
if update.Message != nil {
|
||||||
|
if update.Message.Text != "" {
|
||||||
snd := v1.SendData{
|
snd := v1.SendData{
|
||||||
Message: v1.SendMessage{
|
Message: v1.SendMessage{
|
||||||
Message: v1.Message{
|
Message: v1.Message{
|
||||||
@ -115,8 +116,10 @@ func telegramWebhookHandler(w http.ResponseWriter, r *http.Request, token string
|
|||||||
logger.Debugf("telegramWebhookHandler Type: SendMessage, Bot: %v, Message: %v, Response: %v", b.ID, snd, data)
|
logger.Debugf("telegramWebhookHandler Type: SendMessage, Bot: %v, Message: %v, Response: %v", b.ID, snd, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if update.EditedMessage != nil {
|
if update.EditedMessage != nil {
|
||||||
|
if update.EditedMessage.Text != "" {
|
||||||
snd := v1.UpdateData{
|
snd := v1.UpdateData{
|
||||||
Message: v1.UpdateMessage{
|
Message: v1.UpdateMessage{
|
||||||
Message: v1.Message{
|
Message: v1.Message{
|
||||||
@ -140,6 +143,7 @@ func telegramWebhookHandler(w http.ResponseWriter, r *http.Request, token string
|
|||||||
logger.Debugf("telegramWebhookHandler Type: UpdateMessage, Bot: %v, Message: %v, Response: %v", b.ID, snd, data)
|
logger.Debugf("telegramWebhookHandler Type: UpdateMessage, Bot: %v, Message: %v, Response: %v", b.ID, snd, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user