fix(discord): notification groupings

This commit is contained in:
Jef LeCompte
2020-12-11 18:04:22 -05:00
parent 064ce83f03
commit ad0b2fe525
2 changed files with 6 additions and 5 deletions
+2 -3
View File
@@ -17,7 +17,7 @@ You can test your notification configuration by running `npm run test:notificati
| Environment variable | Description | | 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_3060TI` | Discord group to notify on 3060 Ti stock |
| `DISCORD_NOTIFY_GROUP_3070` | Discord group to notify on 3070 stock | | `DISCORD_NOTIFY_GROUP_3070` | Discord group to notify on 3070 stock |
| `DISCORD_NOTIFY_GROUP_3080` | Discord group to notify on 3080 stock | | `DISCORD_NOTIFY_GROUP_3080` | Discord group to notify on 3080 stock |
@@ -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 | | `DISCORD_WEB_HOOK` | Discord Web Hook URL. Can be comma separated. Use whole webhook URL |
???+ note ???+ 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 role, please use `<@&2834729847239842>`
- If you're using a user, please use `<@2834729847239842>` - If you're using a user, please use `<@2834729847239842>`
+4 -2
View File
@@ -48,12 +48,14 @@ export function sendDiscordMessage(link: Link, store: Store) {
let notifyText: string[] = []; let notifyText: string[] = [];
if (notifyGroup) {
notifyText = notifyText.concat(notifyGroup);
}
if (Object.keys(notifyGroupSeries).indexOf(link.series) !== 0) { if (Object.keys(notifyGroupSeries).indexOf(link.series) !== 0) {
notifyText = notifyText.concat( notifyText = notifyText.concat(
notifyGroupSeries[link.series] notifyGroupSeries[link.series]
); );
} else if (notifyGroup) {
notifyText = notifyText.concat(notifyGroup); // If there is no group for the series we
} }
const promises = []; const promises = [];