accept discord.gg urls

This commit is contained in:
Bram Hagens 2024-02-08 10:22:16 +01:00
parent 9b1a5d4d26
commit 6d464176df
No known key found for this signature in database
GPG key ID: CEF9728B2127ECDC

View file

@ -24,7 +24,7 @@ limitations under the License.
import * as E from '../enums.js' import * as E from '../enums.js'
import { ServiceProvider } from '../serviceProvider.js' import { ServiceProvider } from '../serviceProvider.js'
export const reURI = /^https:\/\/discord\.com\/invite\/(.+)/ export const reURI = /^https:\/\/(?:discord\.gg|discord\.com\/invite)\/(.+)/
/** /**
* @function * @function
@ -89,8 +89,28 @@ export const tests = [
uri: 'https://discord.com/invite/AbCdEfGh', uri: 'https://discord.com/invite/AbCdEfGh',
shouldMatch: true shouldMatch: true
}, },
{
uri: 'https://discord.gg/AbCdEf',
shouldMatch: true
},
{
uri: 'https://discord.gg/AbCdEfGh',
shouldMatch: true
},
{ {
uri: 'https://domain.com/invite/AbCdEf', uri: 'https://domain.com/invite/AbCdEf',
shouldMatch: false shouldMatch: false
},
{
uri: 'https://domain.gg/AbCdEf',
shouldMatch: false
},
{
uri: 'https://discord.com/invite/',
shouldMatch: false
}
{
uri: 'https://discord.gg/',
shouldMatch: false
} }
] ]