From 6d464176dff964dab62ba02833814effecec4910 Mon Sep 17 00:00:00 2001 From: Bram Hagens Date: Thu, 8 Feb 2024 10:22:16 +0100 Subject: [PATCH] accept discord.gg urls --- src/serviceProviders/discord.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/serviceProviders/discord.js b/src/serviceProviders/discord.js index b995af5..f15f86c 100644 --- a/src/serviceProviders/discord.js +++ b/src/serviceProviders/discord.js @@ -24,7 +24,7 @@ limitations under the License. import * as E from '../enums.js' import { ServiceProvider } from '../serviceProvider.js' -export const reURI = /^https:\/\/discord\.com\/invite\/(.+)/ +export const reURI = /^https:\/\/(?:discord\.gg|discord\.com\/invite)\/(.+)/ /** * @function @@ -89,8 +89,28 @@ export const tests = [ uri: 'https://discord.com/invite/AbCdEfGh', shouldMatch: true }, + { + uri: 'https://discord.gg/AbCdEf', + shouldMatch: true + }, + { + uri: 'https://discord.gg/AbCdEfGh', + shouldMatch: true + }, { uri: 'https://domain.com/invite/AbCdEf', shouldMatch: false + }, + { + uri: 'https://domain.gg/AbCdEf', + shouldMatch: false + }, + { + uri: 'https://discord.com/invite/', + shouldMatch: false + } + { + uri: 'https://discord.gg/', + shouldMatch: false } ]