Fix portal

This commit is contained in:
Dragon Fire
2021-04-18 08:41:04 -04:00
parent 09924d6973
commit 360313c9ea
+2
View File
@@ -204,6 +204,7 @@ module.exports = class Util {
} }
static stripInvites(str, { guild = true, bot = true, text = '[redacted invite]' } = {}) { static stripInvites(str, { guild = true, bot = true, text = '[redacted invite]' } = {}) {
if (!str) return '';
if (guild) str = str.replace(inviteRegex, text); if (guild) str = str.replace(inviteRegex, text);
if (bot) str = str.replace(botInvRegex, text); if (bot) str = str.replace(botInvRegex, text);
return str; return str;
@@ -233,6 +234,7 @@ module.exports = class Util {
} }
static stripNSFWURLs(str, siteList, text = '[redacted nsfw url]') { static stripNSFWURLs(str, siteList, text = '[redacted nsfw url]') {
if (!str) return '';
const uris = str.match(/(https?:\/\/\S+)/g); const uris = str.match(/(https?:\/\/\S+)/g);
if (!uris) return str; if (!uris) return str;
for (const uri of uris) { for (const uri of uris) {