uploader_6.py 926 B

123456789101112131415161718192021222324
  1. def send_reminders(all_targets):
  2. """Send reminders for unsent pictures because of internet outage."""
  3. mail_list = []
  4. msg = "There are unsent pictures on the Whiteboardbot SD-Card, \
  5. because of an Internet outage on the last trigger. \
  6. They are automatically going to get deleted in 30 days."
  7. for action, activated in all_targets.items():
  8. if activated:
  9. if action == 'slack':
  10. SlackBot.send_message(SlackBot, msg, attachment=None,
  11. channel=get_key("Slack", "channel_name"))
  12. else:
  13. mail_list.append(action)
  14. if len(mail_list) > 0:
  15. addresses = []
  16. print(mail_list)
  17. for mail_num in mail_list:
  18. addresses.append(get_key(mail_num, "address"))
  19. # TODO check if this handover worked correctly
  20. send_reminder(addresses, msg)
  21. return time()