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

cut off the lang string

This commit is contained in:
DmitryZagorulko 2018-07-11 10:17:20 +03:00
parent 2b07b57f5e
commit 3986469502

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 { if config.Debug {
logger.Debugf("telegramWebhookHandler user %v", user) 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, Firstname: update.Message.From.FirstName,
Avatar: user.UserPhotoURL, Avatar: user.UserPhotoURL,
Lastname: update.Message.From.LastName, Lastname: update.Message.From.LastName,
Language: update.Message.From.LanguageCode, Language: lang,
}, },
Channel: b.Channel, Channel: b.Channel,
ExternalChatID: strconv.FormatInt(update.Message.Chat.ID, 10), ExternalChatID: strconv.FormatInt(update.Message.Chat.ID, 10),