Skip to content

Commit

Permalink
fix(discord): notification groupings
Browse files Browse the repository at this point in the history
  • Loading branch information
jef committed Dec 11, 2020
1 parent 064ce83 commit ad0b2fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions docs/reference/notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ You can test your notification configuration by running `npm run test:notificati

| Environment variable | Description |
|:---:|---|
| `DISCORD_NOTIFY_GROUP` | Discord group you would like to notify. Can be comma separated |
| `DISCORD_NOTIFY_GROUP` | Discord group you would like to notify |
| `DISCORD_NOTIFY_GROUP_3060TI` | Discord group to notify on 3060 Ti stock |
| `DISCORD_NOTIFY_GROUP_3070` | Discord group to notify on 3070 stock |
| `DISCORD_NOTIFY_GROUP_3080` | Discord group to notify on 3080 stock |
Expand All @@ -34,9 +34,8 @@ You can test your notification configuration by running `npm run test:notificati
| `DISCORD_WEB_HOOK` | Discord Web Hook URL. Can be comma separated. Use whole webhook URL |

???+ note
If you don't assign a value to a series group it will always fallback to `DISCORD_NOTIFY_GROUP`.
All ground can be comma separated. `DISCORD_NOTIFY_GROUP` is always used if set.

???+ note
- If you're using a role, please use `<@&2834729847239842>`
- If you're using a user, please use `<@2834729847239842>`

Expand Down
6 changes: 4 additions & 2 deletions src/notification/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ export function sendDiscordMessage(link: Link, store: Store) {

let notifyText: string[] = [];

if (notifyGroup) {
notifyText = notifyText.concat(notifyGroup);
}

if (Object.keys(notifyGroupSeries).indexOf(link.series) !== 0) {
notifyText = notifyText.concat(
notifyGroupSeries[link.series]
);
} else if (notifyGroup) {
notifyText = notifyText.concat(notifyGroup); // If there is no group for the series we
}

const promises = [];
Expand Down

0 comments on commit ad0b2fe

Please sign in to comment.