mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-08 15:19:14 +02:00
Derpibooru Command
This commit is contained in:
@@ -8,14 +8,14 @@
|
||||
|
||||
Xiao is a Discord bot coded in JavaScript with
|
||||
[discord.js](https://discord.js.org/) using the
|
||||
[Commando](https://github.com/discordjs/Commando) command framework. With nearly
|
||||
[Commando](https://github.com/discordjs/Commando) command framework. With
|
||||
300 commands, she is one of the most feature-filled bots out there.
|
||||
|
||||
## Invite
|
||||
The bot is no longer available for invite. You can self-host the bot, or use her
|
||||
on the [home server](https://discord.gg/sbMe32W).
|
||||
|
||||
## Commands (299)
|
||||
## Commands (300)
|
||||
### Utility:
|
||||
|
||||
* **eval**: Executes JavaScript code.
|
||||
@@ -117,6 +117,7 @@ on the [home server](https://discord.gg/sbMe32W).
|
||||
|
||||
* **bulbapedia**: Searches Bulbapedia for your query.
|
||||
* **danbooru**: Responds with an image from Danbooru, with optional query.
|
||||
* **derpibooru**: Responds with an image from Derpibooru.
|
||||
* **deviantart**: Responds with an image from a DeviantArt section, with optional query.
|
||||
* **dictionary**: Defines a word.
|
||||
* **discord-js-docs**: Searches the Discord.js docs for your query.
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
|
||||
module.exports = class DerpibooruCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'derpibooru',
|
||||
aliases: ['derpibooru-image'],
|
||||
group: 'search',
|
||||
memberName: 'derpibooru',
|
||||
description: 'Responds with an image from Derpibooru.',
|
||||
args: [
|
||||
{
|
||||
key: 'query',
|
||||
prompt: 'What image would you like to search for?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { query }) {
|
||||
try {
|
||||
const search = await request
|
||||
.get('https://derpibooru.org/search.json')
|
||||
.query({
|
||||
q: query,
|
||||
random_image: 1
|
||||
});
|
||||
if (!search.body) return msg.say('Could not find any results.');
|
||||
const { body } = await request.get(`https://derpibooru.org/images/${search.body.id}.json`);
|
||||
return msg.say(`https:${body.representations.full}`);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "85.9.3",
|
||||
"version": "85.10.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user