summaryrefslogtreecommitdiff
path: root/src/home/telegram/bot.py
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-12-24 19:09:33 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-12-24 19:09:33 +0300
commit14f885f1a7f0697f3b9311c36e2ad805cf3e3f5c (patch)
tree497cb9a2701d62428108c64e9de0c289ea66f990 /src/home/telegram/bot.py
parent0a065f48be99d4ebae49de622a335f23e50c6ca0 (diff)
relay_mqtt_bot, pump_mqtt_bot
Diffstat (limited to 'src/home/telegram/bot.py')
-rw-r--r--src/home/telegram/bot.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/home/telegram/bot.py b/src/home/telegram/bot.py
index bd09f42..9e60b70 100644
--- a/src/home/telegram/bot.py
+++ b/src/home/telegram/bot.py
@@ -123,15 +123,25 @@ def handler(**kwargs):
return _handler_of_handler(f=f, *args, **inner_kwargs)
messages = []
+ texts = []
+
if 'messages' in kwargs:
messages += kwargs['messages']
if 'message' in kwargs:
messages.append(kwargs['message'])
+
+ if 'text' in kwargs:
+ texts.append(kwargs['text'])
+ if 'texts' in kwargs:
+ texts.append(kwargs['texts'])
+
if messages:
- _updater.dispatcher.add_handler(
- MessageHandler(text_filter(*list(itertools.chain.from_iterable([lang.all(m) for m in messages]))), _handler),
- group=0
- )
+ texts = list(itertools.chain.from_iterable([lang.all(m) for m in messages]))
+
+ _updater.dispatcher.add_handler(
+ MessageHandler(text_filter(*texts), _handler),
+ group=0
+ )
if 'command' in kwargs:
_updater.dispatcher.add_handler(CommandHandler(kwargs['command'], _handler), group=0)