summaryrefslogtreecommitdiff
path: root/include/py
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2023-06-11 03:20:01 +0300
committerEvgeny Zinoviev <me@ch1p.io>2023-06-11 03:20:01 +0300
commit0109d6c01db94822757cd7cb84034dd6f4d6cea8 (patch)
treec5551dc0839d45251dff06001341375f209d9ba6 /include/py
parent975d2bc6ed6d588187fea4bb538e04ac30cbd989 (diff)
inverter bot: migrate to PTB 20 (not tested yet)
Diffstat (limited to 'include/py')
-rw-r--r--include/py/homekit/inverter/monitor.py2
-rw-r--r--include/py/homekit/telegram/bot.py20
2 files changed, 11 insertions, 11 deletions
diff --git a/include/py/homekit/inverter/monitor.py b/include/py/homekit/inverter/monitor.py
index 86f75ac..5955d92 100644
--- a/include/py/homekit/inverter/monitor.py
+++ b/include/py/homekit/inverter/monitor.py
@@ -25,7 +25,7 @@ def _pd_from_string(pd: str) -> BatteryPowerDirection:
class MonitorConfig:
def __getattr__(self, item):
- return config['monitor'][item]
+ return config.app_config['monitor'][item]
cfg = MonitorConfig()
diff --git a/include/py/homekit/telegram/bot.py b/include/py/homekit/telegram/bot.py
index 8a78c6f..2efd9e4 100644
--- a/include/py/homekit/telegram/bot.py
+++ b/include/py/homekit/telegram/bot.py
@@ -274,7 +274,7 @@ class conversation:
continue
cd = f.__dict__['_conv_data']
if cd['enter'] and cd['state'] == state:
- return cd['orig_f'](self, ctx)
+ return await cd['orig_f'](self, ctx)
raise RuntimeError(f'invoke: failed to find method for state {state}')
@@ -362,14 +362,14 @@ class conversation:
# buttons.insert(0, [ctx.lang('back')])
buttons.append([ctx.lang('back')])
- def reply(self,
- ctx: Context,
- state: Union[int, Enum],
- text: str,
- buttons: Optional[list],
- with_cancel=False,
- with_back=False,
- buttons_lang_completed=False):
+ async def reply(self,
+ ctx: Context,
+ state: Union[int, Enum],
+ text: str,
+ buttons: Optional[list],
+ with_cancel=False,
+ with_back=False,
+ buttons_lang_completed=False):
if buttons:
new_buttons = []
@@ -400,7 +400,7 @@ class conversation:
self.add_back_button(ctx, new_buttons)
markup = ReplyKeyboardMarkup(new_buttons, one_time_keyboard=True) if new_buttons else IgnoreMarkup()
- ctx.reply(text, markup=markup)
+ await ctx.reply(text, markup=markup)
self.set_user_state(ctx.user_id, state)
return state