From dc9e708e32ef2ddd175c85b4414cd7251be83d93 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Mon, 5 Apr 2021 21:56:08 -0400 Subject: [PATCH] NSFW URL Command --- commands/analyze/{nsfw.js => nsfw-image.js} | 8 +++--- commands/analyze/nsfw-url.js | 28 +++++++++++++++++++++ package.json | 2 +- 3 files changed, 33 insertions(+), 5 deletions(-) rename commands/analyze/{nsfw.js => nsfw-image.js} (87%) create mode 100644 commands/analyze/nsfw-url.js diff --git a/commands/analyze/nsfw.js b/commands/analyze/nsfw-image.js similarity index 87% rename from commands/analyze/nsfw.js rename to commands/analyze/nsfw-image.js index 56dcae90..6f466576 100644 --- a/commands/analyze/nsfw.js +++ b/commands/analyze/nsfw-image.js @@ -10,13 +10,13 @@ const displayNames = { Sexy: 'Suggestive' }; -module.exports = class NsfwCommand extends Command { +module.exports = class NsfwImageCommand extends Command { constructor(client) { super(client, { - name: 'nsfw', - aliases: ['nsfw-image', 'nsfw-img', 'img-nsfw', 'image-nsfw'], + name: 'nsfw-image', + aliases: ['nsfw', 'nsfw-img', 'img-nsfw', 'image-nsfw'], group: 'analyze', - memberName: 'nsfw', + memberName: 'nsfw-image', description: 'Determines if an image is NSFW.', throttling: { usages: 2, diff --git a/commands/analyze/nsfw-url.js b/commands/analyze/nsfw-url.js new file mode 100644 index 00000000..71849169 --- /dev/null +++ b/commands/analyze/nsfw-url.js @@ -0,0 +1,28 @@ +const Command = require('../../structures/Command'); +const { isUrlNSFW } = require('../../util/Util'); + +module.exports = class NsfwUrlCommand extends Command { + constructor(client) { + super(client, { + name: 'nsfw-url', + aliases: ['nsfw-uri', 'url-nsfw', 'uri-nsfw'], + group: 'analyze', + memberName: 'nsfw-url', + description: 'Determines if a URL is NSFW.', + args: [ + { + key: 'url', + prompt: 'What URL would you like to test?', + type: 'url' + } + ] + }); + } + + async run(msg, { url }) { + const nsfw = await isUrlNSFW(url, this.client.adultSiteList); + if (nsfw === null) return msg.reply('❔ This site sent an error, or just didn\'t respond.'); + if (!nsfw) return msg.reply('👍 This site is safe!'); + return msg.reply('👎 This site is NSFW.'); + } +}; diff --git a/package.json b/package.json index 6326ed10..61899afd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "134.7.0", + "version": "134.8.0", "description": "Your personal server companion.", "main": "Xiao.js", "private": true,