From 34254f7ca9bbda96bfeb5f90d8d0df7ccb83fa3f Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sun, 28 Feb 2021 15:21:31 -0500 Subject: [PATCH] Speed-up NSFW checks --- commands/other/screenshot.js | 2 +- util/Util.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/other/screenshot.js b/commands/other/screenshot.js index d74d79d9..d99547b7 100644 --- a/commands/other/screenshot.js +++ b/commands/other/screenshot.js @@ -33,7 +33,7 @@ module.exports = class ScreenshotCommand extends Command { async run(msg, { site }) { try { const parsed = url.parse(site); - if (!msg.channel.nsfw && this.client.adultSiteList.some(pornURL => parsed.host === pornURL)) { + if (!msg.channel.nsfw && this.client.adultSiteList.includes(parsed.host)) { return msg.reply('This site is NSFW.'); } const { body } = await request.get(`https://image.thum.io/get/width/1920/crop/675/noanimate/${site}`); diff --git a/util/Util.js b/util/Util.js index 433ba689..62b6d70a 100644 --- a/util/Util.js +++ b/util/Util.js @@ -210,7 +210,7 @@ module.exports = class Util { if (!uris) return str; for (const uri of uris) { const parsed = url.parse(uri); - if (!siteList.some(pornURL => parsed.host === pornURL)) continue; + if (!siteList.includes(parsed.host)) continue; str = str.replace(uri, text); } return str;