From 246b727d0a21b81aee06e462542b3847d0cda46a Mon Sep 17 00:00:00 2001 From: Mahmoud Osama Date: Sun, 4 May 2025 19:59:39 +0300 Subject: [PATCH] Update notification messages format Update notification messages format to use Emojis with: * Discord * Gotify * Ntfy --- send_discord.py | 8 +++----- send_gotify.py | 4 ++-- send_ntfy.py | 8 ++++---- send_slack.py | 8 ++++---- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/send_discord.py b/send_discord.py index 16e2465..35e882f 100644 --- a/send_discord.py +++ b/send_discord.py @@ -27,9 +27,9 @@ def github_send_to_discord(releases, webhook_url): logger.info(f"The version of {app_name} has not changed. No notification sent.") continue # Move on to the next application - message = f"New version: {version_number}\nFor: {app_name}\nPublished on: {release_date}\nChangelog:\n{changelog}\n{app_url}" + message = f"šŸ“Œ *New version*: {version_number}\n\nšŸ“¦*For*: {app_name}\n\nšŸ“… *Published on*: {release_date}\n\nšŸ“ *Changelog*:\n\n```{changelog}```" if len(message) > 2000: - message = f"New version: {version_number}\nFor: {app_name}\nPublished on: {release_date}\nFull changelog: {app_url}" + message = f"šŸ“Œ *New version*: {version_number}\n\nšŸ“¦*For*: {app_name}\n\nšŸ“… *Published on*: {release_date}\n\nšŸ”— *Release Link*: {app_url}" # Updating the previous version for this application cursor.execute( "INSERT OR REPLACE INTO versions (repo, version, changelog) VALUES (?, ?, ?)", @@ -67,9 +67,7 @@ def docker_send_to_discord(releases, webhook_url): logger.info(f"The digest of {app_name} has not changed. No notification sent.") continue - message = f"New version for {app_name}\nDigest: {digest_number}\nPublished on: {release_date}\n{app_url}" - if len(message) > 2000: - message = f"New version for {app_name}\nDigest: {digest_number}\nPublished on: {release_date}\nFull details: {app_url}" + message = f"🐳 *Docker Image Updated!*\n\nšŸ” *New Digest*: `{digest_number}`\n\nšŸ“¦ *App*: {app_name}\n\nšŸ“¢*Published*: {release_date}\n\nšŸ”— *Link*: {app_url}" cursor.execute( "INSERT OR REPLACE INTO docker_versions (repo, digest) VALUES (?, ?)", diff --git a/send_gotify.py b/send_gotify.py index 367b56d..6cf9a98 100644 --- a/send_gotify.py +++ b/send_gotify.py @@ -34,7 +34,7 @@ def github_send_to_gotify(releases, token, url): logger.info(f"The version of {app_name} has not changed. No notification sent.") continue # Move on to the next application - message = f"New version: {version_number}\nFor: {app_name}\nPublished on: {release_date}\nChangelog:\n{changelog}\n{app_url}" + message = f"šŸ“Œ *New version*: {version_number}\n\nšŸ“¦*For*: {app_name}\n\nšŸ“… *Published on*: {release_date}\n\nšŸ“ *Changelog*:\n\n```{changelog}```\n\nšŸ”— *Release Url*:{app_url}" # Updating the previous version for this application cursor.execute( "INSERT OR REPLACE INTO versions (repo, version, changelog) VALUES (?, ?, ?)", @@ -77,7 +77,7 @@ def docker_send_to_gotify(releases, token, url): logger.info(f"The digest of {app_name} has not changed. No notification sent.") continue # Move on to the next application - message = f"New version: {digest_number}\nFor: {app_name}\nPublished on: {release_date}\n{app_url}" + message = f"🐳 *Docker Image Updated!*\n\nšŸ” *New Digest*: `{digest_number}`\n\nšŸ“¦ *App*: {app_name}\n\nšŸ“¢ *Published*: {release_date}\n\nšŸ”— *Release Url*:{app_url}" # Updating the previous digest for this application cursor.execute( "INSERT OR REPLACE INTO docker_versions (repo, digest) VALUES (?, ?, ?)", diff --git a/send_ntfy.py b/send_ntfy.py index 210d1d3..3e4395d 100644 --- a/send_ntfy.py +++ b/send_ntfy.py @@ -32,7 +32,7 @@ def github_send_to_ntfy(releases, auth, url): logger.info(f"The version of {app_name} has not changed. No notification sent.") continue # Move on to the next application - message = f"New version: {version_number}\nFor: {app_name}\nPublished on: {release_date}\nChangelog:\n{changelog}\n{app_url}" + message = f"šŸ“Œ *New version*: {version_number}\n\nšŸ“¦*For*: {app_name}\n\nšŸ“… *Published on*: {release_date}\n\nšŸ“ *Changelog*:\n\n```{changelog}```\n\n šŸ”— *Release Url*: {app_url}" # Updating the previous version for this application cursor.execute( "INSERT OR REPLACE INTO versions (repo, version, changelog) VALUES (?, ?, ?)", @@ -75,7 +75,7 @@ def docker_send_to_ntfy(releases, auth, url): logger.info(f"The digest of {app_name} has not changed. No notification sent.") continue # Move on to the next application - message = f"New version: {digest_number}\nFor: {app_name}\nPublished on: {release_date}\n{app_url}" + message = f"🐳 *Docker Image Updated!*\n\nšŸ” *New Digest*: `{digest_number}`\n\nšŸ“¦ *App*: {app_name}\n\nšŸ“¢*Published*: {release_date}\n\n šŸ”— *Release Url*: {app_url}" # Updating the previous digest for this application cursor.execute( "INSERT OR REPLACE INTO docker_versions (repo, digest) VALUES (?, ?, ?)", @@ -85,10 +85,10 @@ def docker_send_to_ntfy(releases, auth, url): headers = { "Authorization": f"Basic {auth}", - "Title": f"New version for {app_name}", + "Title": f"šŸ†• New version for {app_name}", "Priority": "urgent", "Markdown": "yes", - "Actions": f"view, Update {app_name}, {app_url}, clear=true", + "Actions": f"View, Update {app_name}, {app_url}, clear=true", } response = requests.post(f"{url}", headers=headers, data=message) if response.status_code == 200: diff --git a/send_slack.py b/send_slack.py index 3a7a7f5..a064675 100644 --- a/send_slack.py +++ b/send_slack.py @@ -29,7 +29,7 @@ def github_send_to_slack(releases, webhook_url): message = f"šŸ“Œ *New version*: {version_number}\n\nšŸ“¦*For*: {app_name}\n\nšŸ“… *Published on*: {release_date}\n\nšŸ“ *Changelog*:\n\n```{changelog}```" if len(message) > 2000: - message = f"šŸ“Œ *New version*: {version_number}\n\nšŸ“¦*For*: {app_name}\n\nšŸ“… *Published on*: {release_date}\n\nšŸ“ *Changelog*:\n\n `check url since the changelog is huge`" + message = f"šŸ“Œ *New version*: {version_number}\n\nšŸ“¦*For*: {app_name}\n\nšŸ“… *Published on*: {release_date}\n\nšŸ“ *Changelog*:\n\n `truncated..` use šŸ”— instead " cursor.execute( "INSERT OR REPLACE INTO versions (repo, version, changelog) VALUES (?, ?, ?)", @@ -50,7 +50,7 @@ def github_send_to_slack(releases, webhook_url): "type": "button", "text": { "type": "plain_text", - "text": "šŸ”— Changelog url" + "text": "šŸ”— Release Url" }, "url": f"{app_url}", "action_id": "button-action" @@ -87,7 +87,7 @@ def docker_send_to_slack(releases, webhook_url): logger.info(f"The digest of {app_name} has not changed. No notification sent.") continue - message = f"🐳 *Docker Image Updated!*\n\nšŸ” *New Digest*: `{digest_number}`\n\nšŸ“¦ *App*: {app_name}\n\n*Published*: {release_date}" + message = f"🐳 *Docker Image Updated!*\n\nšŸ” *New Digest*: `{digest_number}`\n\nšŸ“¦ *App*: {app_name}\n\nšŸ“¢*Published*: {release_date}" cursor.execute( "INSERT OR REPLACE INTO docker_versions (repo, digest) VALUES (?, ?)", @@ -107,7 +107,7 @@ def docker_send_to_slack(releases, webhook_url): "type": "button", "text": { "type": "plain_text", - "text": "šŸ”— Changelog url" + "text": "šŸ”— Release Url" }, "url": f"{app_url}", "action_id": "button-action"