1
0
mirror of synced 2024-11-22 12:26:02 +03:00

Merge pull request #22 from DmitryZagorulko/master

cut off the lang string
This commit is contained in:
Alex Lushpai 2018-07-12 18:36:52 +03:00 committed by GitHub
commit e7a16f83ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -124,6 +124,12 @@ func telegramWebhookHandler(w http.ResponseWriter, r *http.Request, token string
}
}
lang := update.Message.From.LanguageCode
if len(update.Message.From.LanguageCode) > 2 {
lang = update.Message.From.LanguageCode[:2]
}
if config.Debug {
logger.Debugf("telegramWebhookHandler user %v", user)
}
@ -143,7 +149,7 @@ func telegramWebhookHandler(w http.ResponseWriter, r *http.Request, token string
Firstname: update.Message.From.FirstName,
Avatar: user.UserPhotoURL,
Lastname: update.Message.From.LastName,
Language: update.Message.From.LanguageCode,
Language: lang,
},
Channel: b.Channel,
ExternalChatID: strconv.FormatInt(update.Message.Chat.ID, 10),