diff --git a/chat.py b/chat.py index c17760d..1f2c643 100644 --- a/chat.py +++ b/chat.py @@ -40,6 +40,10 @@ def send_messages_to_chat(projects_by_owner): logger.info('Chat integration is not active.') return + today_weekday=dt.today().strftime('%A') + initial_message = f'Happy {today_weekday}!' + send_message(initial_message) + for owner in projects_by_owner.keys(): user_to_mention = USERS_MAP.get(owner, owner) message = "Hey *@{}*, I've noticed you are one of the owners of the following projects:\n\n".format(user_to_mention) @@ -68,7 +72,8 @@ def send_messages_to_chat(projects_by_owner): if send_message_to_this_owner: send_message(message) - today_weekday=dt.today().strftime('%A') - final_of_execution_message = f'Happy {today_weekday}!!! \nZombie Projects Watcher ran successfully \ - and found {number_of_notified_projects} projects with costs higher than the defined notification threshold of ${COST_MIN_TO_NOTIFY}.' + final_of_execution_message = f'\nToday I found *{number_of_notified_projects} projects* with costs higher \ + than the defined notification threshold of ${COST_MIN_TO_NOTIFY}.\ + \n\n_Note: Only projects whose owner is a real user (and not a Service Account) were considered._' + send_message(final_of_execution_message) diff --git a/slack.py b/slack.py index 1b8506c..b792a81 100644 --- a/slack.py +++ b/slack.py @@ -46,6 +46,10 @@ def send_messages_to_slack(projects_by_owner): logger.info('Slack integration is not active.') return + today_weekday=dt.today().strftime('%A') + initial_message = f'Happy {today_weekday}!' + prepare_message(TEAM_CHANNEL, initial_message) + for owner in projects_by_owner.keys(): slack_user = USERS_MAP.get(owner, owner) message = "Hey @{}, I've noticed you are one of the owners of the following projects:\n".format(slack_user) @@ -70,9 +74,10 @@ def send_messages_to_slack(projects_by_owner): if send_message_to_this_owner: prepare_message(slack_user, message) - today_weekday=dt.today().strftime('%A') - final_of_execution_message = f'Happy {today_weekday}!!! \nZombie Projects Watcher ran successfully \ - and found {number_of_notified_projects} projects with costs higher than the defined notification threshold ${COST_MIN_TO_NOTIFY}.' + final_of_execution_message = '\nToday I found *{number_of_notified_projects} projects* with costs higher \ + than the defined notification threshold ${COST_MIN_TO_NOTIFY}.\ + \n\n_Note: Only projects whose owner is a real user (and not a Service Account) were considered._' + prepare_message(TEAM_CHANNEL, final_of_execution_message) def _send_message(channel, message):