fix(WebhookClient): Updated webhook url regex (#6804)

This commit is contained in:
IlluminatiFish
2022-01-08 11:42:50 +00:00
committed by GitHub
parent 1db6c2d37e
commit 1c615d1bb2

View File

@@ -30,7 +30,7 @@ class WebhookClient extends BaseClient {
if ('url' in data) {
const url = data.url.match(
// eslint-disable-next-line no-useless-escape
/^https?:\/\/(?:canary|ptb)?\.?discord\.com\/api\/webhooks(?:\/v[0-9]\d*)?\/([^\/]+)\/([^\/]+)/i,
/https?:\/\/(?:ptb\.|canary\.)?discord\.com\/api(?:\/v\d{1,2})?\/webhooks\/(\d{17,19})\/([\w-]{68})/i,
);
if (!url || url.length <= 1) throw new Error('WEBHOOK_URL_INVALID');