diff --git a/commands/random-img/danbooru.js b/commands/random-img/danbooru.js deleted file mode 100644 index 8d6c985e..00000000 --- a/commands/random-img/danbooru.js +++ /dev/null @@ -1,42 +0,0 @@ -const Command = require('../../structures/Command'); -const { stripIndents } = require('common-tags'); -const snekfetch = require('snekfetch'); - -module.exports = class DanbooruCommand extends Command { - constructor(client) { - super(client, { - name: 'danbooru', - group: 'random-img', - memberName: 'danbooru', - description: 'Searches Danbooru with optional query.', - nsfw: true, - args: [ - { - key: 'query', - prompt: 'What would you like to search for?', - type: 'string', - default: '', - validate: query => { - if (!query.includes(' ')) return true; - return 'Please only search for one tag at a time.'; - } - } - ] - }); - } - - async run(msg, args) { - const { query } = args; - const { body } = await snekfetch - .get('https://danbooru.donmai.us/posts.json') - .query({ - tags: `${query ? `${query} ` : ''}order:random`, - limit: 1 - }); - if (!body.length || !body[0].file_url) return msg.say('No Results'); - return msg.say(stripIndents` - ${query ? `Result for ${query}:` : 'Random Image:'} - https://danbooru.donmai.us${body[0].file_url} - `); - } -}; diff --git a/commands/random-img/gelbooru.js b/commands/random-img/gelbooru.js deleted file mode 100644 index 3b0d5928..00000000 --- a/commands/random-img/gelbooru.js +++ /dev/null @@ -1,44 +0,0 @@ -const Command = require('../../structures/Command'); -const { stripIndents } = require('common-tags'); -const snekfetch = require('snekfetch'); -const { promisify } = require('util'); -const xml = promisify(require('xml2js').parseString); - -module.exports = class GelbooruCommand extends Command { - constructor(client) { - super(client, { - name: 'gelbooru', - group: 'random-img', - memberName: 'gelbooru', - description: 'Searches Gelbooru with optional query.', - nsfw: true, - args: [ - { - key: 'query', - prompt: 'What would you like to search for?', - type: 'string', - default: '' - } - ] - }); - } - - async run(msg, args) { - const { query } = args; - const { text } = await snekfetch - .get('https://gelbooru.com/index.php') - .query({ - page: 'dapi', - s: 'post', - q: 'index', - tags: query, - limit: 200 - }); - const { posts } = await xml(text); - if (posts.$.count === '0') return msg.say('No Results.'); - return msg.say(stripIndents` - ${query ? `Result for ${query}:` : 'Random Image:'} - https:${posts.post[Math.floor(Math.random() * posts.post.length)].$.file_url} - `); - } -}; diff --git a/commands/random-img/konachan.js b/commands/random-img/konachan.js deleted file mode 100644 index 9d946607..00000000 --- a/commands/random-img/konachan.js +++ /dev/null @@ -1,38 +0,0 @@ -const Command = require('../../structures/Command'); -const { stripIndents } = require('common-tags'); -const snekfetch = require('snekfetch'); - -module.exports = class KonachanCommand extends Command { - constructor(client) { - super(client, { - name: 'konachan', - group: 'random-img', - memberName: 'konachan', - description: 'Searches Konachan with optional query.', - nsfw: true, - args: [ - { - key: 'query', - prompt: 'What would you like to search for?', - type: 'string', - default: '' - } - ] - }); - } - - async run(msg, args) { - const { query } = args; - const { body } = await snekfetch - .get('https://konachan.net/post.json') - .query({ - tags: `${query ? `${query} ` : ''}order:random`, - limit: 1 - }); - if (!body.length) return msg.say('No Results.'); - return msg.say(stripIndents` - ${query ? `Result for ${query}:` : 'Random Image:'} - https:${body[0].file_url} - `); - } -}; diff --git a/commands/random-img/rule34.js b/commands/random-img/rule34.js deleted file mode 100644 index 3c0c36eb..00000000 --- a/commands/random-img/rule34.js +++ /dev/null @@ -1,44 +0,0 @@ -const Command = require('../../structures/Command'); -const { stripIndents } = require('common-tags'); -const snekfetch = require('snekfetch'); -const { promisify } = require('util'); -const xml = promisify(require('xml2js').parseString); - -module.exports = class Rule34Command extends Command { - constructor(client) { - super(client, { - name: 'rule34', - group: 'random-img', - memberName: 'rule34', - description: 'Searches Rule34 with optional query.', - nsfw: true, - args: [ - { - key: 'query', - prompt: 'What would you like to search for?', - type: 'string', - default: '' - } - ] - }); - } - - async run(msg, args) { - const { query } = args; - const { text } = await snekfetch - .get('https://rule34.xxx/index.php') - .query({ - page: 'dapi', - s: 'post', - q: 'index', - tags: query, - limit: 200 - }); - const { posts } = await xml(text); - if (posts.$.count === '0') return msg.say('No Results.'); - return msg.say(stripIndents` - ${query ? `Result for ${query}:` : 'Random Image:'} - https:${posts.post[Math.floor(Math.random() * posts.post.length)].$.file_url} - `); - } -}; diff --git a/commands/random-img/safebooru.js b/commands/random-img/safebooru.js deleted file mode 100644 index f1ea54e4..00000000 --- a/commands/random-img/safebooru.js +++ /dev/null @@ -1,44 +0,0 @@ -const Command = require('../../structures/Command'); -const { stripIndents } = require('common-tags'); -const snekfetch = require('snekfetch'); -const { promisify } = require('util'); -const xml = promisify(require('xml2js').parseString); - -module.exports = class SafebooruCommand extends Command { - constructor(client) { - super(client, { - name: 'safebooru', - group: 'random-img', - memberName: 'safebooru', - description: 'Searches Safebooru with optional query.', - nsfw: true, - args: [ - { - key: 'query', - prompt: 'What would you like to search for?', - type: 'string', - default: '' - } - ] - }); - } - - async run(msg, args) { - const { query } = args; - const { text } = await snekfetch - .get('http://safebooru.org/index.php') - .query({ - page: 'dapi', - s: 'post', - q: 'index', - tags: query, - limit: 200 - }); - const { posts } = await xml(text); - if (posts.$.count === '0') return msg.say('No Results.'); - return msg.say(stripIndents` - ${query ? `Result for ${query}:` : 'Random Image:'} - http:${posts.post[Math.floor(Math.random() * posts.post.length)].$.file_url} - `); - } -}; diff --git a/package.json b/package.json index 59489007..66548da8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "30.8.1", + "version": "31.0.0", "description": "Your personal server companion.", "main": "Shard.js", "scripts": { diff --git a/structures/Command.js b/structures/Command.js index 9eb0096c..d86f2cf5 100644 --- a/structures/Command.js +++ b/structures/Command.js @@ -6,7 +6,6 @@ class XiaoCommand extends Command { super(client, info); this.ownerOnly = info.ownerOnly; - this.nsfw = info.nsfw; this.clientPermissions = info.clientPermissions; this.userPermissions = info.userPermissions; this.throttling = info.throttling || { @@ -17,7 +16,6 @@ class XiaoCommand extends Command { hasPermission(msg) { if (this.ownerOnly && !this.client.isOwner(msg.author)) return 'This Command can only be used by the bot owner.'; - if (this.nsfw && !msg.channel.nsfw) return 'This Command can only be used in NSFW Channels.'; if (msg.channel.type === 'text') { if (this.clientPermissions) { for (const permission of this.clientPermissions) {