diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2022-07-01 22:29:57 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2022-07-01 22:29:57 +0300 |
commit | 04113564e54267c7539b5955179e36d7ddae1ff2 (patch) | |
tree | e37cc9d2dc81f4b03c822b3eb435f1a81a8daa64 /src/polaris_kettle_bot.py | |
parent | 6f8d419c3e54a26b21067ee39da105aa74e4ec42 (diff) |
polaris_kettle_bot: fix glitch when turning off
Diffstat (limited to 'src/polaris_kettle_bot.py')
-rwxr-xr-x | src/polaris_kettle_bot.py | 11 |
1 files changed, 8 insertions, 3 deletions
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) |