Skip to content

Commit

Permalink
feat(pushover): add support for sound (jef#2203)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fmstrat authored and erwinc1 committed Mar 31, 2021
1 parent a572532 commit 5f7ca39
Show file tree
Hide file tree
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
Expand Up @@ -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"`
Expand Down
1 change: 1 addition & 0 deletions dotenv-example
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ PUSHOVER_RETRY=
PUSHOVER_TOKEN=
PUSHOVER_USER=
PUSHOVER_PRIORITY=
PUSHOVER_SOUND=
RESTART_TIME=
SCREENSHOT=
SHOW_ONLY_BRANDS=
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
Expand Down
2 changes: 2 additions & 0 deletions src/notification/pushover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`}),
Expand Down
2 changes: 1 addition & 1 deletion src/types/pushover-notifications.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ declare module 'pushover-notifications' {
message: string;
priority?: number;
retry?: number;
sound?: Sound;
sound?: string;
timestamp?: number;
title?: string;
url?: string;
Expand Down

0 comments on commit 5f7ca39

Please sign in to comment.