mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Quote, Random in Gelbooru and Rule34, Reorder Groups
This commit is contained in:
@@ -5,7 +5,7 @@ module.exports = class FishyCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'fishy',
|
||||
group: 'random-res',
|
||||
group: 'games',
|
||||
memberName: 'fishy',
|
||||
description: 'Catches a fish.'
|
||||
});
|
||||
@@ -6,7 +6,7 @@ module.exports = class DanbooruCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'danbooru',
|
||||
group: 'search',
|
||||
group: 'random-img',
|
||||
memberName: 'danbooru',
|
||||
description: 'Searches Danbooru with optional query.',
|
||||
nsfw: true,
|
||||
@@ -8,15 +8,16 @@ module.exports = class GelbooruCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'gelbooru',
|
||||
group: 'search',
|
||||
group: 'random-img',
|
||||
memberName: 'gelbooru',
|
||||
description: 'Searches Gelbooru for your query.',
|
||||
description: 'Searches Gelbooru with optional query.',
|
||||
nsfw: true,
|
||||
args: [
|
||||
{
|
||||
key: 'query',
|
||||
prompt: 'What would you like to search for?',
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
default: ''
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -31,13 +32,13 @@ module.exports = class GelbooruCommand extends Command {
|
||||
s: 'post',
|
||||
q: 'index',
|
||||
tags: query,
|
||||
limit: 1
|
||||
limit: 200
|
||||
});
|
||||
const { posts } = await xml.parseStringAsync(text);
|
||||
if (posts.$.count === '0') return msg.say('No Results.');
|
||||
return msg.say(stripIndents`
|
||||
Result for ${query}:
|
||||
https:${posts.post[0].$.file_url}
|
||||
https:${posts.post[Math.floor(Math.random * posts.post.length)].$.file_url}
|
||||
`);
|
||||
}
|
||||
};
|
||||
@@ -6,7 +6,7 @@ module.exports = class KonachanCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'konachan',
|
||||
group: 'search',
|
||||
group: 'random-img',
|
||||
memberName: 'konachan',
|
||||
description: 'Searches Konachan with optional query.',
|
||||
nsfw: true,
|
||||
@@ -8,15 +8,16 @@ module.exports = class Rule34Command extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'rule34',
|
||||
group: 'search',
|
||||
group: 'random-img',
|
||||
memberName: 'rule34',
|
||||
description: 'Searches Rule34 for your query.',
|
||||
description: 'Searches Rule34 with optional query.',
|
||||
nsfw: true,
|
||||
args: [
|
||||
{
|
||||
key: 'query',
|
||||
prompt: 'What would you like to search for?',
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
default: ''
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -31,13 +32,13 @@ module.exports = class Rule34Command extends Command {
|
||||
s: 'post',
|
||||
q: 'index',
|
||||
tags: query,
|
||||
limit: 1
|
||||
limit: 200
|
||||
});
|
||||
const { posts } = await xml.parseStringAsync(text);
|
||||
if (posts.$.count === '0') return msg.say('No Results.');
|
||||
return msg.say(stripIndents`
|
||||
Result for ${query}:
|
||||
https:${posts.post[0].$.file_url}
|
||||
https:${posts.post[Math.floor(Math.random() * posts.post.length)].$.file_url}
|
||||
`);
|
||||
}
|
||||
};
|
||||
@@ -5,7 +5,7 @@ module.exports = class XiaoCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'xiao',
|
||||
aliases: ['xiao-pai'],
|
||||
aliases: ['xiao-pai', 'iao'],
|
||||
group: 'random-img',
|
||||
memberName: 'xiao',
|
||||
description: 'Responds with a random image of Xiao Pai.',
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class QuoteCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'quote',
|
||||
group: 'random-res',
|
||||
memberName: 'quote',
|
||||
description: 'Responds with a random quote.',
|
||||
clientPermissions: ['EMBED_LINKS']
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
const { body } = await snekfetch
|
||||
.get('https://api.forismatic.com/api/1.0/')
|
||||
.query({
|
||||
method: 'getQuote',
|
||||
lang: 'en',
|
||||
format: 'json'
|
||||
});
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x9797FF)
|
||||
.setURL(body.quoteLink)
|
||||
.setAuthor(body.quoteAuthor)
|
||||
.setDescription(body.quoteText);
|
||||
return msg.embed(embed);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,8 +6,8 @@ module.exports = class TodayCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'today',
|
||||
aliases: ['event'],
|
||||
group: 'random',
|
||||
aliases: ['event', 'history'],
|
||||
group: 'random-res',
|
||||
memberName: 'today',
|
||||
description: 'Responds with an event that occurred today in history, or on a specific day.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
@@ -5,7 +5,7 @@ module.exports = class VocaloidCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'vocaloid',
|
||||
group: 'random-img',
|
||||
group: 'random-res',
|
||||
memberName: 'vocaloid',
|
||||
description: 'Responds with a random VOCALOID song.'
|
||||
});
|
||||
@@ -7,7 +7,7 @@ module.exports = class WouldYouRatherCommand extends Command {
|
||||
super(client, {
|
||||
name: 'would-you-rather',
|
||||
aliases: ['wy-rather'],
|
||||
group: 'random',
|
||||
group: 'random-res',
|
||||
memberName: 'would-you-rather',
|
||||
description: 'Responds with a random would you rather question.',
|
||||
clientPermissions: ['EMBED_LINKS']
|
||||
@@ -7,7 +7,7 @@ module.exports = class XKCDCommand extends Command {
|
||||
super(client, {
|
||||
name: 'xkcd',
|
||||
aliases: ['kcd'],
|
||||
group: 'search',
|
||||
group: 'random',
|
||||
memberName: 'xkcd',
|
||||
description: 'Gets an XKCD Comic, optionally opting for today\'s or a specific number.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "27.6.1",
|
||||
"version": "27.7.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Shard.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user