diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2022-10-21 02:43:15 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2022-10-21 02:43:15 +0300 |
commit | 3bac4b316dc275c1c22b93cde5ebac87df1d3234 (patch) | |
tree | 8c61b4afe2fef946bea24cdb0d2496935dc7bb4c /src | |
parent | 2fc72f67cd7b566e7d9875712784642043339c79 (diff) |
inverter_bot: add osp button on main screen
Diffstat (limited to 'src')
-rwxr-xr-x | src/inverter_bot.py | 10 |
1 files changed, 8 insertions, 2 deletions
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) |