from discord_webhook import DiscordWebhook, DiscordEmbed from bathook import bathook webhookURL = "https://discordapp.com/api/webhooks/758550057598582804/DogsHl5AEKwMr01LJ_ddSUuAZcfW2eCEybZDGFjBUMIBKTVXCvD7D2d2I6zDNaoQNu1j" maxCharPerMessage = 1994 bathook = bathook("/etc/bacula/scripts/webhooks/Aidan-Bacula-Mail.md", "SporkMC (and mounted storages)") for message_part in bathook.get_formatted_message(): # For every message part in the truncated output, run this loop # Form the embedded stuff (unique for aidan's server) #embed = DiscordEmbed() #embed.set_author(name="Snowsune's Tape Daemon", icon_url="https://kitsunehosting.net/nextcloud/index.php/apps/files_sharing/publicpreview/zzygHFxJQXjXxMz?x=1920&y=553&a=true&file=TapeImage.JPG&scalingup=0") #embed.set_timestamp() #embed.add_embed_field(name='Field 1', value='Lorem ipsum') #message_part = "```" + message_part + "```" # Encapsulate the messsage #print(message_part) #webhook = DiscordWebhook(url=webhookURL, username="Snowsune's SporkMC Bacula Daemon", content=message_part) # Attach the message #webhook.add_embed(embed) #response = webhook.execute() # Hit send webhook = DiscordWebhook(url=webhookURL, username="Snowsune's Nextcloud-Bacula Daemon") # Attach the message webhook.add_embed(bathook.get_discord_embed()) response = webhook.execute() # Hit send