From 9b612632540e44a7d46075d8a77b59d5adc9c8ae Mon Sep 17 00:00:00 2001 From: Radek Golan Date: Wed, 24 Apr 2024 15:16:16 +0200 Subject: [PATCH] Fix attachments Attachments were still being sent by the wrong webhook Attachments now have the `ansi` extension (text coloring) --- src/discord_notifier/__main__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/discord_notifier/__main__.py b/src/discord_notifier/__main__.py index ce33c2a..3560dda 100644 --- a/src/discord_notifier/__main__.py +++ b/src/discord_notifier/__main__.py @@ -68,6 +68,8 @@ webhook.add_embed(DiscordEmbed( try: if not success: logfile_webhook = DiscordWebhook(environ["PLUGIN_WEBHOOK_URL"], rate_limit_retry=True) + logfile_webhook.username = "Woodpecker CI" + logfile_webhook.avatar_url = "https://ci.shielddagger.com/favicons/favicon-dark-error.png" with APISession(environ["PLUGIN_WOODPECKER_URL"].rstrip("/")) as client: client.headers.setdefault("Authorization", f"Bearer {environ["PLUGIN_WOODPECKER_TOKEN"]}") @@ -86,7 +88,7 @@ try: logdata = b"" for logline in loginfo: logdata += b64decode(logline["data"]) - webhook.add_file(logdata, f"{step['name']}.log") + logfile_webhook.add_file(logdata, f"{step['name']}.ansi") except KeyError: webhook.add_embed(DiscordEmbed( "API Error",