From ad0b2fe525d6403735ddcbf4ef55b91eb36ac10a Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Fri, 11 Dec 2020 18:04:22 -0500 Subject: [PATCH] fix(discord): notification groupings --- docs/reference/notification.md | 5 ++--- src/notification/discord.ts | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/reference/notification.md b/docs/reference/notification.md index 0441253c56..19cd8dc033 100644 --- a/docs/reference/notification.md +++ b/docs/reference/notification.md @@ -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 | @@ -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>` diff --git a/src/notification/discord.ts b/src/notification/discord.ts index 9f284480fd..e0c7477994 100644 --- a/src/notification/discord.ts +++ b/src/notification/discord.ts @@ -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 = [];