mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-08 07:11:49 +02:00
A fun little command.
This commit is contained in:
@@ -8,7 +8,7 @@ Xiao is a Discord bot coded in JavaScript with
|
||||
300 commands, she is one of the most feature-filled bots out there, and formerly
|
||||
served over 10,000 servers with a uniquely devoted fanbase.
|
||||
|
||||
## Commands (296)
|
||||
## Commands (297)
|
||||
### Utility:
|
||||
|
||||
* **prefix**: Shows or sets the command prefix.
|
||||
@@ -151,6 +151,7 @@ served over 10,000 servers with a uniquely devoted fanbase.
|
||||
* **recipe**: Searches for recipes based on your query.
|
||||
* **rotten-tomatoes**: Searches Rotten Tomatoes for your query.
|
||||
* **rule-of-the-internet**: Responds with a rule of the internet.
|
||||
* **rule34**: Responds with an image from Rule34, with optional query.
|
||||
* **safebooru**: Responds with an image from Safebooru, with optional query.
|
||||
* **spoopy-link**: Determines if a link is spoopy or not.
|
||||
* **stack-overflow**: Searches Stack Overflow for your query.
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class Rule34Command extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'rule34',
|
||||
aliases: ['rule34-image'],
|
||||
group: 'search',
|
||||
memberName: 'rule34',
|
||||
description: 'Responds with an image from Rule34, with optional query.',
|
||||
nsfw: true,
|
||||
args: [
|
||||
{
|
||||
key: 'query',
|
||||
prompt: 'What image would you like to search for?',
|
||||
type: 'string',
|
||||
default: ''
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { query }) {
|
||||
try {
|
||||
const { text } = await snekfetch
|
||||
.get('https://rule34.xxx/index.php')
|
||||
.query({
|
||||
page: 'dapi',
|
||||
s: 'post',
|
||||
q: 'index',
|
||||
json: 1,
|
||||
tags: query,
|
||||
limit: 200
|
||||
});
|
||||
if (!text) return msg.say('Could not find any results.');
|
||||
const body = JSON.parse(text);
|
||||
const data = body[Math.floor(Math.random() * body.length)];
|
||||
return msg.say(`https://rule34.xxx/images/${data.directory}/${data.image}`);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "70.2.0",
|
||||
"version": "70.3.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user