From 3bac4b316dc275c1c22b93cde5ebac87df1d3234 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Fri, 21 Oct 2022 02:43:15 +0300 Subject: inverter_bot: add osp button on main screen --- src/inverter_bot.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/inverter_bot.py b/src/inverter_bot.py index 285fdeb..f2be2c6 100755 --- a/src/inverter_bot.py +++ b/src/inverter_bot.py @@ -486,6 +486,7 @@ class InverterBot(Wrapper): self.lang.ru( status='Статус', generation='Генерация', + osp='Приоритет питания нагрузки', battery="АКБ", load="Нагрузка", generator="Генератор", @@ -562,6 +563,7 @@ class InverterBot(Wrapper): self.lang.en( status='Status', generation='Generation', + osp='Output source priority', battery="Battery", load="Load", generator="Generator", @@ -668,7 +670,10 @@ class InverterBot(Wrapper): )) self.add_handler(ConversationHandler( - entry_points=[CommandHandler('setosp', self.wrap(setosp_start), self.user_filter)], + entry_points=[ + CommandHandler('setosp', self.wrap(setosp_start), self.user_filter), + MessageHandler(text_filter(self.lang.all('osp')), self.wrap(setosp_start)) + ], states={ SETOSP_STARTED: [ *[MessageHandler(text_filter(self.lang.all(f'setosp_{sp.value.lower()}')), self.wrap(setosp_input)) for sp in OutputSourcePriority], @@ -682,7 +687,8 @@ class InverterBot(Wrapper): def markup(self, ctx: Optional[Context]) -> Optional[ReplyKeyboardMarkup]: button = [ - [ctx.lang('status'), ctx.lang('generation')] + [ctx.lang('status'), ctx.lang('generation')], + [ctx.lang('osp')] ] return ReplyKeyboardMarkup(button, one_time_keyboard=False) -- cgit v1.2.3