mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-09 01:04:16 +02:00
Speed-up NSFW checks
This commit is contained in:
@@ -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
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user