From 04113564e54267c7539b5955179e36d7ddae1ff2 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Fri, 1 Jul 2022 22:29:57 +0300 Subject: polaris_kettle_bot: fix glitch when turning off --- src/polaris_kettle_bot.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/polaris_kettle_bot.py') diff --git a/src/polaris_kettle_bot.py b/src/polaris_kettle_bot.py index 5b8c312..a512bf7 100755 --- a/src/polaris_kettle_bot.py +++ b/src/polaris_kettle_bot.py @@ -683,16 +683,21 @@ class KettleBot(Wrapper): return def done(ok: bool): + mode = kc.info.mode if not ok: html, markup = Renderer.smth_went_wrong(ctx) else: - html, markup = Renderer.turned_off(ctx, mode=kc.info.mode) + kw = {} + if mode == PowerType.OFF: + kw['reached'] = True + kw['no_keyboard'] = True + html, markup = Renderer.turned_off(ctx, mode=mode, **kw) message = ctx.reply(html, markup=markup) logger.debug(f'ctx.reply returned message: {message}') - if ok: + if ok and mode != PowerType.OFF: mut = MessageUpdatingTarget(ctx, message, - initial_power_mode=kc.info.mode, + initial_power_mode=mode, user_enabled_power_mode=PowerType.OFF) mut.set_rendered_content((html, markup)) kc.add_updating_message(mut) -- cgit v1.2.3