diff --git a/src/notifiers/discord.ts b/src/notifiers/discord.ts index d21b267..ae9bc5e 100644 --- a/src/notifiers/discord.ts +++ b/src/notifiers/discord.ts @@ -42,7 +42,7 @@ export class DiscordNotifier extends NotifierService { }, ], title: 'Click to proceed', - url, + ...(url ? { url } : {}), }, ], }, diff --git a/src/notifiers/email.ts b/src/notifiers/email.ts index ea8f59d..5a8c090 100644 --- a/src/notifiers/email.ts +++ b/src/notifiers/email.ts @@ -36,7 +36,7 @@ export class EmailNotifier extends NotifierService { to: this.config.emailRecipientAddress, subject: `Epic Games free games needs an action performed`, html: `

epicgames-freegames-node, reason: ${reason}, account: ${account}.

-

Link: ${url}

`, + ${url ? `

Link: ${url}

` : ''}`, textEncoding: 'base64', // Some email clients don't like the '=' in the URL when using quoted-printable? }); L.debug( diff --git a/src/notifiers/gotify.ts b/src/notifiers/gotify.ts index f316b2a..3d09770 100644 --- a/src/notifiers/gotify.ts +++ b/src/notifiers/gotify.ts @@ -18,21 +18,26 @@ export class GotifyNotifier extends NotifierService { const jsonPayload = { title: `Epic Games free games needs an action performed`, /** - * ATTENTION: these are markdown, to make it breaking lines correctly, there is two spaces at the end of line and before the retrun + * ATTENTION: these are markdown; to make lines break correctly, there + * are two spaces at the end of line and before the retrun */ message: `* Reason: ${reason} * Account: ${account} -* URL: [${url}](${url})`, +${url ? `* URL: [${url}](${url})` : ''}`, priority: this.config.priority, extras: { 'client::display': { contentType: 'text/markdown', }, - 'client::notification': { - click: { - url, - }, - }, + ...(url + ? { + 'client::notification': { + click: { + url, + }, + } + } + : {}), }, }; diff --git a/src/notifiers/homeassistant.ts b/src/notifiers/homeassistant.ts index 1ff8089..01be865 100644 --- a/src/notifiers/homeassistant.ts +++ b/src/notifiers/homeassistant.ts @@ -23,8 +23,7 @@ export class HomeassistantNotifier extends NotifierService { title: `Action request from Epic Games`, message: `epicgames needs an action performed. Reason: ${reason} {{ '\n' -}} Link: ${url}`, data: { - url, - clickAction: url, + ...(url ? { url, clickAction: url } : {}), ...(this.config.customData ?? {}), }, }, diff --git a/src/notifiers/ntfy.ts b/src/notifiers/ntfy.ts index a9ebe71..cc1e78e 100644 --- a/src/notifiers/ntfy.ts +++ b/src/notifiers/ntfy.ts @@ -25,8 +25,8 @@ export class NtfyNotifier extends NotifierService { Title: 'epicgames-freegames-node needs an action performed', Priority: this.config.priority, Tags: 'closed_lock_with_key', - Click: url, Authorization: `Bearer ${this.config.token}`, + ...(url ? { Click: url } : {}), }, responseType: 'text', }, diff --git a/src/notifiers/pushover.ts b/src/notifiers/pushover.ts index 040307f..cb83633 100644 --- a/src/notifiers/pushover.ts +++ b/src/notifiers/pushover.ts @@ -23,7 +23,7 @@ export class PushoverNotifier extends NotifierService { token: this.config.token, user: this.config.userKey, message: `epicgames-freegames-node needs an action performed. Reason: ${reason}`, - url, + ...(url ? { url } : {}), }, { responseType: 'json', diff --git a/src/notifiers/slack.ts b/src/notifiers/slack.ts index 80246b6..1e8bc6b 100644 --- a/src/notifiers/slack.ts +++ b/src/notifiers/slack.ts @@ -20,7 +20,7 @@ export class SlackNotifier extends NotifierService { await axios.post( this.config.webhookUrl, { - text: `epicgames-freegames-node needs an action performed. \nReason: ${reason} \nAccount: ${account} \nURL: ${url}`, + text: `epicgames-freegames-node needs an action performed. \nReason: ${reason} \nAccount: ${account}${url ? ` \nURL: ${url}` : ''}`, }, { responseType: 'text', diff --git a/src/notifiers/webhook.ts b/src/notifiers/webhook.ts index 2635abc..f679fa8 100644 --- a/src/notifiers/webhook.ts +++ b/src/notifiers/webhook.ts @@ -22,7 +22,7 @@ export class WebhookNotifier extends NotifierService { { account, reason, - url, + ...(url ? { url } : {}), }, { responseType: 'json',