Speed-up NSFW checks

This commit is contained in:
Dragon Fire
2021-02-28 15:21:31 -05:00
parent 9b32178f65
commit 34254f7ca9
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ module.exports = class ScreenshotCommand extends Command {
async run(msg, { site }) { async run(msg, { site }) {
try { try {
const parsed = url.parse(site); 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.'); return msg.reply('This site is NSFW.');
} }
const { body } = await request.get(`https://image.thum.io/get/width/1920/crop/675/noanimate/${site}`); const { body } = await request.get(`https://image.thum.io/get/width/1920/crop/675/noanimate/${site}`);
+1 -1
View File
@@ -210,7 +210,7 @@ module.exports = class Util {
if (!uris) return str; if (!uris) return str;
for (const uri of uris) { for (const uri of uris) {
const parsed = url.parse(uri); const parsed = url.parse(uri);
if (!siteList.some(pornURL => parsed.host === pornURL)) continue; if (!siteList.includes(parsed.host)) continue;
str = str.replace(uri, text); str = str.replace(uri, text);
} }
return str; return str;