Bacula/Dir Config/scripts/webhooks/ChrisProElite-Bacula-Webhoo...

14 lines
677 B
Python

from discord_webhook import DiscordWebhook
from bathook import bathook
webhookURL = "https://discordapp.com/api/webhooks/742784012640190565/NBhtbWpDdgMZPx7uCXO8Ofw-o8Lez0V17EBGIvYv7FTIeTENK24GHNL3krUbYnOOIJ63"
maxCharPerMessage = 1994
bathook = bathook("/etc/bacula/scripts/webhooks/ChrisProEliteMail.md", "nextcloud")
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