mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-23 18:05:01 +02:00
NSFW Commands
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
const { Command } = require('discord.js-commando');
|
||||||
|
const snekfetch = require('snekfetch');
|
||||||
|
|
||||||
|
module.exports = class DanbooruCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'danbooru',
|
||||||
|
group: 'nsfw',
|
||||||
|
memberName: 'danbooru',
|
||||||
|
description: 'Sends an image from Danbooru, with optional query.',
|
||||||
|
guildOnly: true,
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'query',
|
||||||
|
prompt: 'What would you like to search for?',
|
||||||
|
type: 'string',
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, args) {
|
||||||
|
if (!msg.channel.nsfw) return msg.say('This Command can only be used in NSFW Channels.');
|
||||||
|
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
|
const { query } = args;
|
||||||
|
try {
|
||||||
|
const { body } = await snekfetch
|
||||||
|
.get('https://danbooru.donmai.us/posts.json')
|
||||||
|
.query({
|
||||||
|
tags: `${query ? `${query} ` : ''}order:random`,
|
||||||
|
limit: 1
|
||||||
|
});
|
||||||
|
if (!body.length) throw new Error('No Results.');
|
||||||
|
return msg.say(query ? `Result for ${query}:` : 'Random Image:', { files: [`https://danbooru.domai.us${body[0].file_url}`] })
|
||||||
|
.catch(err => msg.say(`${err.name}: ${err.message}`));
|
||||||
|
} catch (err) {
|
||||||
|
return msg.say(`${err.name}: ${err.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
const { Command } = require('discord.js-commando');
|
||||||
|
const snekfetch = require('snekfetch');
|
||||||
|
const { promisify } = require('tsubaki');
|
||||||
|
const xml = promisify(require('xml2js').parseString);
|
||||||
|
|
||||||
|
module.exports = class GelbooruCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'gelbooru',
|
||||||
|
group: 'nsfw',
|
||||||
|
memberName: 'gelbooru',
|
||||||
|
description: 'Sends an image from Gelbooru, with query.',
|
||||||
|
guildOnly: true,
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'query',
|
||||||
|
prompt: 'What would you like to search for?',
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, args) {
|
||||||
|
if (!msg.channel.nsfw) return msg.say('This Command can only be used in NSFW Channels.');
|
||||||
|
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
|
const { query } = args;
|
||||||
|
try {
|
||||||
|
const { text } = await snekfetch
|
||||||
|
.get('https://gelbooru.com/index.php')
|
||||||
|
.query({
|
||||||
|
page: 'dapi',
|
||||||
|
s: 'post',
|
||||||
|
q: 'index',
|
||||||
|
tags: query,
|
||||||
|
limit: 1
|
||||||
|
});
|
||||||
|
const { posts } = await xml(text);
|
||||||
|
return msg.say(`Result for ${query}:`, { files: [`https:${posts.post[0].$.file_url}`] })
|
||||||
|
.catch(err => msg.say(`${err.name}: ${err.message}`));
|
||||||
|
} catch (err) {
|
||||||
|
return msg.say(`${err.name}: ${err.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -5,9 +5,9 @@ module.exports = class KonachanCommand extends Command {
|
|||||||
constructor(client) {
|
constructor(client) {
|
||||||
super(client, {
|
super(client, {
|
||||||
name: 'konachan',
|
name: 'konachan',
|
||||||
group: 'search',
|
group: 'nsfw',
|
||||||
memberName: 'konachan',
|
memberName: 'konachan',
|
||||||
description: 'Sends a random (Possibly NSFW!) anime image from Konachan, with optional query.',
|
description: 'Sends an image from Konachan, with optional query.',
|
||||||
guildOnly: true,
|
guildOnly: true,
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
const { Command } = require('discord.js-commando');
|
||||||
|
const snekfetch = require('snekfetch');
|
||||||
|
|
||||||
|
module.exports = class LolibooruCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'lolibooru',
|
||||||
|
group: 'nsfw',
|
||||||
|
memberName: 'lolibooru',
|
||||||
|
description: 'Sends an image from Lolibooru, with optional query.',
|
||||||
|
guildOnly: true,
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'query',
|
||||||
|
prompt: 'What would you like to search for?',
|
||||||
|
type: 'string',
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, args) {
|
||||||
|
if (!msg.channel.nsfw) return msg.say('This Command can only be used in NSFW Channels.');
|
||||||
|
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
|
const { query } = args;
|
||||||
|
try {
|
||||||
|
const { body } = await snekfetch
|
||||||
|
.get('https://lolibooru.moe/post/index.json')
|
||||||
|
.query({
|
||||||
|
tags: `${query ? `${query} ` : ''}order:random`,
|
||||||
|
limit: 1
|
||||||
|
});
|
||||||
|
if (!body.length) throw new Error('No Results.');
|
||||||
|
return msg.say(query ? `Result for ${query}:` : 'Random Image:', { files: [body[0].file_url] })
|
||||||
|
.catch(err => msg.say(`${err.name}: ${err.message}`));
|
||||||
|
} catch (err) {
|
||||||
|
return msg.say(`${err.name}: ${err.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
const { Command } = require('discord.js-commando');
|
||||||
|
const snekfetch = require('snekfetch');
|
||||||
|
const { promisify } = require('tsubaki');
|
||||||
|
const xml = promisify(require('xml2js').parseString);
|
||||||
|
|
||||||
|
module.exports = class Rule34Command extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'rule34',
|
||||||
|
group: 'nsfw',
|
||||||
|
memberName: 'rule34',
|
||||||
|
description: 'Sends an image from Rule34, with query.',
|
||||||
|
guildOnly: true,
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'query',
|
||||||
|
prompt: 'What would you like to search for?',
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, args) {
|
||||||
|
if (!msg.channel.nsfw) return msg.say('This Command can only be used in NSFW Channels.');
|
||||||
|
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
|
const { query } = args;
|
||||||
|
try {
|
||||||
|
const { text } = await snekfetch
|
||||||
|
.get('https://rule34.xxx/index.php')
|
||||||
|
.query({
|
||||||
|
page: 'dapi',
|
||||||
|
s: 'post',
|
||||||
|
q: 'index',
|
||||||
|
tags: query,
|
||||||
|
limit: 1
|
||||||
|
});
|
||||||
|
const { posts } = await xml(text);
|
||||||
|
return msg.say(`Result for ${query}:`, { files: [`https:${posts.post[0].$.file_url}`] })
|
||||||
|
.catch(err => msg.say(`${err.name}: ${err.message}`));
|
||||||
|
} catch (err) {
|
||||||
|
return msg.say(`${err.name}: ${err.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<li>Random Roasts, Fortunes, and Compliments!</li>
|
<li>Random Roasts, Fortunes, and Compliments!</li>
|
||||||
<li>Random Fact Core Quotes!</li>
|
<li>Random Fact Core Quotes!</li>
|
||||||
<li>Random Name Generation!</li>
|
<li>Random Name Generation!</li>
|
||||||
<li>Random Anime Images (with NSFW)!</li>
|
<li>NSFW Commands!</li>
|
||||||
<li>Random XKCD Comics!</li>
|
<li>Random XKCD Comics!</li>
|
||||||
<li>Roleplay Commands!</li>
|
<li>Roleplay Commands!</li>
|
||||||
<li>Search Various sites including:</li>
|
<li>Search Various sites including:</li>
|
||||||
@@ -53,7 +53,6 @@
|
|||||||
<li>Wikipedia</li>
|
<li>Wikipedia</li>
|
||||||
<li>YouTube</li>
|
<li>YouTube</li>
|
||||||
<li>YuGiOh! Card Data</li>
|
<li>YuGiOh! Card Data</li>
|
||||||
<li>Konachan</li>
|
|
||||||
<li>My Anime List</li>
|
<li>My Anime List</li>
|
||||||
</ol>
|
</ol>
|
||||||
<li>LMGTFY Link Generation!</li>
|
<li>LMGTFY Link Generation!</li>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<li>Random Roasts, Fortunes, and Compliments!</li>
|
<li>Random Roasts, Fortunes, and Compliments!</li>
|
||||||
<li>Random Fact Core Quotes!</li>
|
<li>Random Fact Core Quotes!</li>
|
||||||
<li>Random Name Generation!</li>
|
<li>Random Name Generation!</li>
|
||||||
<li>Random Anime Images (with NSFW)!</li>
|
<li>NSFW Commands!</li>
|
||||||
<li>Random XKCD Comics!</li>
|
<li>Random XKCD Comics!</li>
|
||||||
<li>Roleplay Commands!</li>
|
<li>Roleplay Commands!</li>
|
||||||
<li>Search Various sites including:</li>
|
<li>Search Various sites including:</li>
|
||||||
@@ -48,7 +48,6 @@
|
|||||||
<li>Wikipedia</li>
|
<li>Wikipedia</li>
|
||||||
<li>YouTube</li>
|
<li>YouTube</li>
|
||||||
<li>YuGiOh! Card Data</li>
|
<li>YuGiOh! Card Data</li>
|
||||||
<li>Konachan</li>
|
|
||||||
<li>My Anime List</li>
|
<li>My Anime List</li>
|
||||||
</ul>
|
</ul>
|
||||||
<li>LMGTFY Link Generation!</li>
|
<li>LMGTFY Link Generation!</li>
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ client.registry
|
|||||||
['numedit', 'Number Manipulation'],
|
['numedit', 'Number Manipulation'],
|
||||||
['search', 'Search'],
|
['search', 'Search'],
|
||||||
['games', 'Games'],
|
['games', 'Games'],
|
||||||
|
['nsfw', 'NSFW'],
|
||||||
['random', 'Random/Other'],
|
['random', 'Random/Other'],
|
||||||
['roleplay', 'Roleplay']
|
['roleplay', 'Roleplay']
|
||||||
])
|
])
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "19.7.1",
|
"version": "19.8.0",
|
||||||
"description": "A Discord Bot",
|
"description": "A Discord Bot",
|
||||||
"main": "shardingmanager.js",
|
"main": "shardingmanager.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user