if current: msg = '*' + message + ': ' + rowmap[date_col] + '*\n' if message_col: msg += message_col + ': ' + rowmap[message_col] + '\n' for user_col in user_cols.split(','): user_col = user_col.strip() if user_col and rowmap[user_col]: user_name = rowmap[user_col].lower() if include_phone: phone_number = format_phone_number(people_phone_numbers[user_name]) else: phone_number = '' try: slack_username = sh.get_username_for_fullname(user_name) except: print('Failed to get Slack username for ' + user_name) exit(1) msg += user_col + ': ' + '@' + sh.get_username_for_fullname(user_name) + ' ' + phone_number + '\n' if testing_slack_channel is not None: slack_channels = [ testing_slack_channel ] else: slack_channels = [s.strip() for s in slack_channels.split(',')] if len(msg) > 0: for idx, slack_channel in enumerate(slack_channels): msg_to_send = msg # Only ack first one
msg = "*" + message + ": " + rowmap[date_col] + "*\n" if message_col: msg += message_col + ": " + rowmap[message_col] + "\n" for user_col in user_cols.split(","): user_col = user_col.strip() if user_col and rowmap[user_col]: user_name = rowmap[user_col].lower() if include_phone: phone_number = format_phone_number( people_phone_numbers[user_name]) else: phone_number = "" try: slack_username = sh.get_username_for_fullname( user_name) except: print("Failed to get Slack username for " + user_name) sys.exit(1) msg += (user_col + ": " + "@" + sh.get_username_for_fullname(user_name) + " " + phone_number + "\n") if testing_slack_channel is not None: slack_channels = [testing_slack_channel] else: slack_channels = [s.strip() for s in slack_channels.split(",")] if len(msg) > 0: for idx, slack_channel in enumerate(slack_channels):