Skip to content

Commit

Permalink
feat(pushover): add support for sound (#2203)
Browse files Browse the repository at this point in the history
Fmstrat authored Mar 25, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 0a9ce0d commit 83ce922
Showing 5 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/reference/notification.md
Original file line number Diff line number Diff line change
@@ -154,6 +154,7 @@ Generate token at [pushover.net/apps/build](https://pushover.net/apps/build).
| `PUSHOVER_PRIORITY` | Message priority |
| `PUSHOVER_TOKEN` | API token |
| `PUSHOVER_USER` | Username |
| `PUSHOVER_SOUND` | Message sound |

???+ note
`PUSHOVER_EXPIRE` and `PUSHOVER_RETRY` are only used when `PUSHOVER_PRIORITY="2"`
1 change: 1 addition & 0 deletions dotenv-example
Original file line number Diff line number Diff line change
@@ -96,6 +96,7 @@ PUSHOVER_RETRY=
PUSHOVER_TOKEN=
PUSHOVER_USER=
PUSHOVER_PRIORITY=
PUSHOVER_SOUND=
RESTART_TIME=
SCREENSHOT=
SHOW_ONLY_BRANDS=
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -302,6 +302,7 @@ const notifications = {
expire: envOrNumber(process.env.PUSHOVER_EXPIRE),
priority: envOrNumber(process.env.PUSHOVER_PRIORITY),
retry: envOrNumber(process.env.PUSHOVER_RETRY),
sound: envOrString(process.env.PUSHOVER_SOUND, 'pushover'),
token: envOrString(process.env.PUSHOVER_TOKEN),
username: envOrString(process.env.PUSHOVER_USER),
},
2 changes: 2 additions & 0 deletions src/notification/pushover.ts
Original file line number Diff line number Diff line change
@@ -19,13 +19,15 @@ export function sendPushoverNotification(link: Link, store: Store) {
? {
message: link.cartUrl ? link.cartUrl : link.url,
priority: pushover.priority,
sound: pushover.sound,
title: Print.inStock(link, store),
...(link.screenshot && {file: `./${link.screenshot}`}),
}
: {
expire: pushover.expire,
message: link.cartUrl ? link.cartUrl : link.url,
priority: pushover.priority,
sound: pushover.sound,
retry: pushover.retry,
title: Print.inStock(link, store),
...(link.screenshot && {file: `./${link.screenshot}`}),
2 changes: 1 addition & 1 deletion src/types/pushover-notifications.d.ts
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ declare module 'pushover-notifications' {
message: string;
priority?: number;
retry?: number;
sound?: Sound;
sound?: string;
timestamp?: number;
title?: string;
url?: string;

0 comments on commit 83ce922

Please sign in to comment.