From b26e3a76db789dd52dbbf696b1983cb990765e48 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Sun, 14 Feb 2021 17:25:38 +0200 Subject: Make stuff pythonic --- hommaexceli_py/telegram_client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'hommaexceli_py/telegram_client.py') diff --git a/hommaexceli_py/telegram_client.py b/hommaexceli_py/telegram_client.py index d11d876..a0f2af8 100644 --- a/hommaexceli_py/telegram_client.py +++ b/hommaexceli_py/telegram_client.py @@ -17,7 +17,11 @@ from functools import partial chats_mem_cache = set() -ALLOWED_USER_IDS = map(lambda id: int(id), getenv("TELEGRAM_USER_IDS", "").split(",")) + + +ALLOWED_USER_IDS = [ + int(id) for id in getenv("TELEGRAM_USER_IDS", "").split(",") if len(id) > 0 +] def _signal_handler(sig, frame): @@ -42,7 +46,7 @@ def _callback_alarm(context: CallbackContext, sheets_service: Resource): logging.info(f"Sending sheet data to chat id {chat_id}...") if len(this_weeks_rows) > 0: message = "Tällä viikolla tehtävät hommat:\n" + "\n".join( - map(lambda task: f"{task.name} ({task.interval})", this_weeks_rows) + f"{task.name} ({task.interval})" for task in this_weeks_rows ) else: message = "Tällä viikolla ei toistuvia hommia! 🎉 " -- cgit v1.3