Bacula/Dir Config/scripts/webhooks/NewImprovedBot.py

12 lines
646 B
Python

from discord_webhook import DiscordWebhook, DiscordEmbed
from bathook import bathook
webhookURL = "https://discordapp.com/api/webhooks/758548414962073670/RsBq2Tex4_mh7mAu_otYzlabW0mFHkcSxnyW4MNl6hFniagT6EEACEPLB9mtIt76NY81"
maxCharPerMessage = 1994
bathook = bathook("/etc/bacula/scripts/webhooks/Aidan-Bacula-Mail.md", "Test")
for message_part in bathook.get_formatted_message(): # For every message part in the truncated output, run this loop
webhook = DiscordWebhook(url=webhookURL, username="Test Embedded bot!") # Attach the message
webhook.add_embed(bathook.get_discord_embed())
response = webhook.execute() # Hit send