From b4fc5d0efa3d4039a0ff8da18f7d749e1a94f9b0 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 6 Sep 2020 03:53:49 +0200 Subject: [PATCH] Hide custom keyboard during Live Orders mode (closes #39) Also fixes a bug with the chinese translation --- strings/en.py | 9 +++++---- strings/it.py | 11 ++++++----- strings/ru.py | 9 +++++---- strings/uk.py | 9 +++++---- strings/zh_cn.py | 18 ++++++++++++------ worker.py | 9 ++++++++- 6 files changed, 41 insertions(+), 24 deletions(-) diff --git a/strings/en.py b/strings/en.py index 55d1387..34bbc4d 100644 --- a/strings/en.py +++ b/strings/en.py @@ -102,13 +102,14 @@ conversation_confirm_cart = "🛒 Your cart contains the following products:\n" "If you want to proceed, press the Done button below this message.\n" \ "To cancel, press the Cancel button." -# Conversation: the user activated the live orders mode +# Live orders mode: start conversation_live_orders_start = "You are in Live Orders mode\n" \ "All new orders placed by customers will appear in real time in this chat, and you" \ " will be able to mark them as ✅ Completed" \ - " or ✴️ Refund the credit to the customer.\n" \ - "\n" \ - "Press the Stop button below this message to stop the" \ + " or ✴️ Refund the credit to the customer." + +# Live orders mode: stop receiving messages +conversation_live_orders_stop = "Press the Stop button below this message to stop the" \ " feed." # Conversation: help menu has been opened diff --git a/strings/it.py b/strings/it.py index 0392576..f8e9869 100644 --- a/strings/it.py +++ b/strings/it.py @@ -102,14 +102,15 @@ conversation_confirm_cart = "🛒 Il tuo carrello contiene questi prodotti:\n" \ "Se vuoi procedere, premi il tasto Fatto sotto a questo messaggio.\n" \ "Per annullare, premi il tasto Annulla." -# Conversation: the user activated the live orders mode +# Live orders mode: start conversation_live_orders_start = "Sei in modalità di Ricezione Ordini!\n" \ "Tutti i nuovi ordini piazzati dai clienti ti appariranno in tempo reale in questa" \ " chat, e potrai segnarli come ✅ completati" \ - " oppure ✴️ rimborsare il credito al cliente.\n" \ - "\n" \ - "Premi il tasto Interrompi sotto a questo messaggio per interrompere la" \ - " ricezione." + " oppure ✴️ rimborsare il credito al cliente." + +# Live orders mode: stop receiving messages +conversation_live_orders_stop = "Premi il tasto Interrompi sotto a questo messaggio per interrompere la" \ + " ricezione." # Conversation: help menu has been opened conversation_open_help_menu = "Che tipo di assistenza desideri ricevere?" diff --git a/strings/ru.py b/strings/ru.py index e093572..6ecd264 100644 --- a/strings/ru.py +++ b/strings/ru.py @@ -99,13 +99,14 @@ conversation_confirm_cart = "🛒 Продукты у Вас в корзине:\ "Нажмите Готово, чтобы продолжить.\n" \ "Если передумали - выберите Отмена." -# Conversation: the user activated the live orders mode +# Live orders mode: start conversation_live_orders_start = "Вы в режиме Новые заказы\n" \ "Все новые заказы появятся в этом чате в режиме реального времени," \ " и их можно отметить ✅ Выполнено" \ - " или ✴️ Возвращено в случае возврата денег.\n" \ - "\n" \ - "Нажмите Стоп в этом чате, чтобы остановить этот режим." + " или ✴️ Возвращено в случае возврата денег." \ + +# Live orders mode: stop receiving messages +conversation_live_orders_stop = "Нажмите Стоп в этом чате, чтобы остановить этот режим." # Conversation: help menu has been opened conversation_open_help_menu = "Чем могу Вам помочь?" diff --git a/strings/uk.py b/strings/uk.py index a9afe08..5844d45 100644 --- a/strings/uk.py +++ b/strings/uk.py @@ -99,13 +99,14 @@ conversation_confirm_cart = "🛒 У вас в кошику наступні п "Щоб продовжити натисніть Готово.\n" \ "Якщо змінили свою думку - обирайте Відміна." -# Conversation: the user activated the live orders mode +# Live orders mode: start conversation_live_orders_start = "Ви в режимі Свіжі Замовлення\n" \ "Всі нові замовення від покупців зʼявляться в цьому чаті в режимі живого часу," \ " і ви зможете помічати їх ✅ Виконано" \ - " або ✴️ Повернути кошти покупцю.\n" \ - "\n" \ - "Натисніть кнопку Стоп в цьому чаті, щоб зупинити цей режим." + " або ✴️ Повернути кошти покупцю." + +# Live orders mode: stop receiving messages +conversation_live_orders_stop = "Натисніть кнопку Стоп в цьому чаті, щоб зупинити цей режим." # Conversation: help menu has been opened conversation_open_help_menu = "Як можемо Вам допомогти?" diff --git a/strings/zh_cn.py b/strings/zh_cn.py index 57fbbe5..9a68ee6 100644 --- a/strings/zh_cn.py +++ b/strings/zh_cn.py @@ -101,12 +101,18 @@ conversation_confirm_cart = "🛒 您的购物车包含以下产品:\n" \ "如果要继续,请按此消息下方的“完成”按钮.\n" \ "如果要取消,请按取消按钮." -# Conversation: the user activated the live orders mode -conversation_live_orders_start = "您处于实时订单模式\n" \ - "客户下的所有新订单将实时显示在此聊天中," \ - "您可以将能够将它们标记为 ✅ 已完成." \ - " 或者 ✴️ 您可以退款给客户.\n" \ - " 反馈" +# Live orders mode: start +# TODO: This string is incomplete! +# conversation_live_orders_start = "您处于实时订单模式\n" \ +# "客户下的所有新订单将实时显示在此聊天中," \ +# "您可以将能够将它们标记为 ✅ 已完成." \ +# " 或者 ✴️ 您可以退款给客户.\n" \ +# " 反馈" + +# Live orders mode: stop receiving messages +# TODO: This string is missing. +# conversation_live_orders_stop = "" + # Conversation: help menu has been opened conversation_open_help_menu = "您需要什么样的帮助?" diff --git a/worker.py b/worker.py index f95ee8c..f416c30 100644 --- a/worker.py +++ b/worker.py @@ -1021,7 +1021,14 @@ class Worker(threading.Thread): cancel_keyboard = telegram.InlineKeyboardMarkup([[telegram.InlineKeyboardButton(self.loc.get("menu_cancel"), callback_data="cmd_cancel")]]) # Send a small intro message on the Live Orders mode - self.bot.send_message(self.chat.id, self.loc.get("conversation_live_orders_start"), reply_markup=stop_keyboard) + # Remove the keyboard with the first message... (#39) + self.bot.send_message(self.chat.id, + self.loc.get("conversation_live_orders_start"), + reply_markup=telegram.ReplyKeyboardRemove()) + # ...and display a small inline keyboard with the following one + self.bot.send_message(self.chat.id, + self.loc.get("conversation_live_orders_stop"), + reply_markup=stop_keyboard) # Create the order keyboard order_keyboard = telegram.InlineKeyboardMarkup([[telegram.InlineKeyboardButton(self.loc.get("menu_complete"), callback_data="order_complete")],