From da5479b901278072216145768f529b77ecb23322 Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Sun, 19 Mar 2023 18:49:24 +0700 Subject: [PATCH] feat: RichPresence support protocol --- src/structures/RichPresence.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/structures/RichPresence.js b/src/structures/RichPresence.js index a60f637..eca54e4 100644 --- a/src/structures/RichPresence.js +++ b/src/structures/RichPresence.js @@ -7,7 +7,15 @@ const getUUID = () => ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, a => (a ^ ((Math.random() * 16) >> (a / 4))).toString(16)); // Function check url valid (ok copilot) // eslint-disable-next-line -const checkUrl = url => /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(url); +const checkUrl = url => { + try { + // eslint-disable-next-line no-new + new URL(url); + return true; + } catch { + return false; + } +}; class CustomStatus { /**