Bacula/scripts/webhooks/Robotics-Bacula-Webhook.py

17 lines
897 B
Python

from discord_webhook import DiscordWebhook
from bathook import bathook
webhookURL = "https://discordapp.com/api/webhooks/740630755259973713/CNhxPBJ4C6UZ-m1DVXUQ54KeJQD3I9Di0sAwldmyjw-s7dMPUWplq7rhGXegpWGtKSve"
maxCharPerMessage = 1994
bathook = bathook("/etc/bacula/scripts/webhooks/RoboticsMail.md", "1721's google drive")
for message_part in bathook.get_formatted_message(): # For every message part in the truncated output, run this loop
#message_part = "```" + message_part + "```" # Encapsulate the messsage
#print(message_part)
#webhook = DiscordWebhook(url=webhookURL, content=message_part) # Attach the message
#response = webhook.execute() # Hit send
webhook = DiscordWebhook(url=webhookURL, username="Tidal Force Tape Backup Daemon") # Attach the message
webhook.add_embed(bathook.get_discord_embed())
response = webhook.execute() # Hit send