mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 05:54:33 +02:00
Remove NSFW Functionality
This commit is contained in:
@@ -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}
|
|
||||||
`);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -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}
|
|
||||||
`);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -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}
|
|
||||||
`);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -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}
|
|
||||||
`);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -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}
|
|
||||||
`);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "30.8.1",
|
"version": "31.0.0",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Shard.js",
|
"main": "Shard.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ class XiaoCommand extends Command {
|
|||||||
super(client, info);
|
super(client, info);
|
||||||
|
|
||||||
this.ownerOnly = info.ownerOnly;
|
this.ownerOnly = info.ownerOnly;
|
||||||
this.nsfw = info.nsfw;
|
|
||||||
this.clientPermissions = info.clientPermissions;
|
this.clientPermissions = info.clientPermissions;
|
||||||
this.userPermissions = info.userPermissions;
|
this.userPermissions = info.userPermissions;
|
||||||
this.throttling = info.throttling || {
|
this.throttling = info.throttling || {
|
||||||
@@ -17,7 +16,6 @@ class XiaoCommand extends Command {
|
|||||||
|
|
||||||
hasPermission(msg) {
|
hasPermission(msg) {
|
||||||
if (this.ownerOnly && !this.client.isOwner(msg.author)) return 'This Command can only be used by the bot owner.';
|
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 (msg.channel.type === 'text') {
|
||||||
if (this.clientPermissions) {
|
if (this.clientPermissions) {
|
||||||
for (const permission of this.clientPermissions) {
|
for (const permission of this.clientPermissions) {
|
||||||
|
|||||||
Reference in New Issue
Block a user