From 48345fc6de7b50370bf44c39fa0e8fa7eb659816 Mon Sep 17 00:00:00 2001 From: DmitryZagorulko Date: Wed, 12 Sep 2018 11:24:44 +0300 Subject: [PATCH] improve translate and SendData message --- src/main.go | 3 +-- src/routing.go | 11 ++++------- src/utils.go | 1 + translate/translate.en.yml | 2 +- translate/translate.es.yml | 2 +- translate/translate.ru.yml | 2 +- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/main.go b/src/main.go index 4bd042b..fdc0960 100644 --- a/src/main.go +++ b/src/main.go @@ -20,8 +20,7 @@ var ( logger *logging.Logger options Options parser = flags.NewParser(&options, flags.Default) - tokenCounter uint32 - rx = regexp.MustCompile(`/+$`) + rx = regexp.MustCompile(`/+$`) ) func main() { diff --git a/src/routing.go b/src/routing.go index 1ae5e31..91527cd 100644 --- a/src/routing.go +++ b/src/routing.go @@ -380,13 +380,10 @@ func telegramWebhookHandler(c *gin.Context) { } snd := v1.SendData{ - Message: v1.SendMessage{ - Message: v1.Message{ - ExternalID: strconv.Itoa(update.Message.MessageID), - Type: "text", - Text: update.Message.Text, - }, - SentAt: time.Now(), + Message: v1.Message{ + ExternalID: strconv.Itoa(update.Message.MessageID), + Type: "text", + Text: update.Message.Text, }, User: v1.User{ ExternalID: strconv.Itoa(update.Message.From.ID), diff --git a/src/utils.go b/src/utils.go index b89f4d5..fe0e859 100644 --- a/src/utils.go +++ b/src/utils.go @@ -18,6 +18,7 @@ import ( ) var ( + tokenCounter uint32 credentialsTransport = []string{ "/api/integration-modules/{code}", "/api/integration-modules/{code}/edit", diff --git a/translate/translate.en.yml b/translate/translate.en.yml index 467fb28..baf1d51 100644 --- a/translate/translate.en.yml +++ b/translate/translate.en.yml @@ -27,7 +27,7 @@ error_creating_webhook: Error when creating a webhook error_adding_bot: Error when adding a bot error_save: Error while saving, contact technical support missing_credentials: "Required methods: {{.Credentials}}" -error_activity_mg: Check if the integration with MessageGateway is enabled in retailCRM settings +error_activity_mg: Check if the integration with retailCRM Chat is enabled in retailCRM settings info_bot: "If you have a problem with connecting a bot, please, refer to the documentation" crm_link: "retailCRM" doc_link: "documentation" diff --git a/translate/translate.es.yml b/translate/translate.es.yml index a6c276e..3641cc4 100644 --- a/translate/translate.es.yml +++ b/translate/translate.es.yml @@ -27,7 +27,7 @@ error_creating_webhook: Error al crear el webhook error_adding_bot: Error al añadir el bot error_save: Error al guardar, contacte con el soporte técnico missing_credentials: "Métodos requeridos: {{.Credenciales}}" -error_activity_mg: Revisar si la integración con MessageGateway está habilitada en Ajustes de retailCRM +error_activity_mg: Revisar si la integración con retailCRM Chat está habilitada en Ajustes de retailCRM info_bot: "Si tiene dificultades para conectar el bot, por favor, consulte la documentación" crm_link: "retailCRM" doc_link: "documentación" diff --git a/translate/translate.ru.yml b/translate/translate.ru.yml index 37096fb..523fe6d 100644 --- a/translate/translate.ru.yml +++ b/translate/translate.ru.yml @@ -27,7 +27,7 @@ error_creating_webhook: Ошибка при создании webhook error_adding_bot: Ошибка при добавлении бота error_save: Ошибка при сохранении, обратитесь в службу технической поддержки missing_credentials: "Необходимые методы: {{.Credentials}}" -error_activity_mg: Проверьте активность интеграции с MessageGateway в настройках retailCRM +error_activity_mg: Проверьте активность интеграции с retailCRM Chat в настройках retailCRM info_bot: "Если у вас возникли трудности при подключении бота, изучите, пожалуйста, документацию" crm_link: "retailCRM" doc_link: "документация"