diff options
Diffstat (limited to 'hommaexceli_py/telegram_client.py')
| -rw-r--r-- | hommaexceli_py/telegram_client.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/hommaexceli_py/telegram_client.py b/hommaexceli_py/telegram_client.py index ad1f478..d11d876 100644 --- a/hommaexceli_py/telegram_client.py +++ b/hommaexceli_py/telegram_client.py @@ -40,9 +40,13 @@ def _callback_alarm(context: CallbackContext, sheets_service: Resource): this_weeks_rows = filter_only_this_week(processed_rows) logging.info(f"Sending sheet data to chat id {chat_id}...") - message = "Tällä viikolla tehtävät hommat:\n" + "\n".join( - map(lambda task: f"{task.name} ({task.interval})", this_weeks_rows) - ) + 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) + ) + else: + message = "Tällä viikolla ei toistuvia hommia! 🎉 " + context.bot.send_message(chat_id=chat_id, text=message) update_sheet_last_done_column(sheets_service, processed_rows) |
