mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Refactor roleplay commands, bro-hoof, meme, remove face, add dotenv support
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
# Discord-related info
|
||||
XIAO_TOKEN=
|
||||
# Seperate OWNERS with a ,
|
||||
OWNERS=
|
||||
XIAO_PREFIX=
|
||||
INVITE=
|
||||
|
||||
# Emoji IDs
|
||||
GOLD_FISH_EMOJI_ID=
|
||||
MOCKING_EMOJI_ID=
|
||||
SILVER_FISH_EMOJI_ID=
|
||||
SUCCESS_EMOJI_ID=
|
||||
|
||||
# API Keys, IDs, and Secrets
|
||||
ALPHA_VANTAGE_KEY=
|
||||
CUSTOM_SEARCH_ID=
|
||||
DEVIANTART_ID=
|
||||
DEVIANTART_SECRET=
|
||||
FLICKR_KEY=
|
||||
GIPHY_KEY=
|
||||
GITHUB_PASSWORD=
|
||||
GITHUB_USERNAME=
|
||||
GOOGLE_CALENDAR_ID=
|
||||
GOOGLE_KEY=
|
||||
GOV_KEY=
|
||||
IMGUR_KEY=
|
||||
OSU_KEY=
|
||||
PERSONAL_GOOGLE_CALENDAR_ID=
|
||||
RIOT_KEY=
|
||||
STACKOVERFLOW_KEY=
|
||||
TMDB_KEY=
|
||||
TUMBLR_KEY=
|
||||
TWITTER_KEY=
|
||||
TWITTER_SECRET=
|
||||
WATTPAD_KEY=
|
||||
WEBHOOK_ID=
|
||||
WEBHOOK_TOKEN=
|
||||
WHATANIME_KEY=
|
||||
WORDNIK_KEY=
|
||||
XIAO_GITHUB_REPO_NAME=
|
||||
XIAO_GITHUB_REPO_USERNAME=
|
||||
YANDEX_KEY=
|
||||
YODA_KEY=
|
||||
|
||||
# Imgur album IDs
|
||||
BREAK_UP_ALBUM_ID=
|
||||
BRO_HOOF_ALBUM_ID=
|
||||
CUDDLE_ALBUM_ID=
|
||||
EAT_ALBUM_ID=
|
||||
EVOLVE_ALBUM_ID=
|
||||
FALCON_PUNCH_ALBUM_ID=
|
||||
FIDGET_ALBUM_ID=
|
||||
FIST_BUMP_ALBUM_ID=
|
||||
HIGH_FIVE_ALBUM_ID=
|
||||
HIT_WITH_SHOVEL_ALBUM_ID=
|
||||
HOLD_HANDS_ALBUM_ID=
|
||||
HUG_ALBUM_ID=
|
||||
INHALE_ALBUM_ID=
|
||||
KILL_ALBUM_ID=
|
||||
KISS_ALBUM_ID=
|
||||
MARRY_ALBUM_ID=
|
||||
PAT_ALBUM_ID=
|
||||
POKE_ALBUM_ID=
|
||||
POSTER_ALBUM_ID=
|
||||
PUNCH_ALBUM_ID=
|
||||
SLAP_ALBUM_ID=
|
||||
TACKLE_ALBUM_ID=
|
||||
XIAO_ALBUM_ID=
|
||||
@@ -63,12 +63,12 @@ on the [home server](https://discord.gg/sbMe32W).
|
||||
* **joke**: Responds with a random joke.
|
||||
* **kiss-marry-kill**: Determines who to kiss, who to marry, and who to kill.
|
||||
* **magic-conch**: Asks your question to the Magic Conch.
|
||||
* **meme**: Responds with a random meme.
|
||||
* **name**: Responds with a random name, with the gender of your choice.
|
||||
* **number-fact**: Responds with a random fact about a specific number.
|
||||
* **offspring**: Determines if your new child will be a boy or a girl.
|
||||
* **opinion**: Determines the opinion on something.
|
||||
* **oracle-turret**: Responds with a random Oracle Turret quote.
|
||||
* **pikachu**: Responds with a random image of Pikachu.
|
||||
* **quantum-coin**: Flips a coin that lands on some form of nothing.
|
||||
* **quote**: Responds with a random quote.
|
||||
* **rate**: Rates something.
|
||||
@@ -174,7 +174,6 @@ on the [home server](https://discord.gg/sbMe32W).
|
||||
|
||||
* **coolness**: Determines a user's coolness.
|
||||
* **dick**: Determines your dick size.
|
||||
* **face-analyze**: Determines the age, gender, and race of a face.
|
||||
* **gender-analyze**: Determines the gender of a name.
|
||||
* **guess-looks**: Guesses what a user looks like.
|
||||
* **psycho-pass**: Determines your Crime Coefficient.
|
||||
@@ -226,6 +225,7 @@ on the [home server](https://discord.gg/sbMe32W).
|
||||
* **be-like-bill**: Sends a "Be Like Bill" meme with the name of your choice.
|
||||
* **color**: Sends an image of the color you choose.
|
||||
* **contrast**: Draws an image or a user's avatar but with contrast.
|
||||
* **create-meme**: Sends a meme with the text and background of your choice.
|
||||
* **create-qr-code**: Converts text to a QR Code.
|
||||
* **demotivational-poster**: Draws an image or a user's avatar and the text you specify as a demotivational poster.
|
||||
* **distort**: Draws an image or a user's avatar but distorted.
|
||||
@@ -235,7 +235,6 @@ on the [home server](https://discord.gg/sbMe32W).
|
||||
* **ifunny**: Draws an image with the iFunny logo.
|
||||
* **illegal**: Makes President Trump make your text illegal.
|
||||
* **invert**: Draws an image or a user's avatar but inverted.
|
||||
* **meme**: Sends a meme with the text and background of your choice.
|
||||
* **minecraft-skin**: Sends the Minecraft skin for a user.
|
||||
* **needs-more-jpeg**: Draws an image or a user's avatar as a low quality JPEG.
|
||||
* **osu-signature**: Creates a card based on an osu! user's stats.
|
||||
@@ -338,6 +337,7 @@ on the [home server](https://discord.gg/sbMe32W).
|
||||
### Roleplay:
|
||||
|
||||
* **break-up**: Breaks up with a user.
|
||||
* **bro-hoof**: Gives a user a bro-hoof.
|
||||
* **cuddle**: Cuddles a user.
|
||||
* **eat**: Eats a user.
|
||||
* **evolve**: Evolves a user.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
require('dotenv').config();
|
||||
const { XIAO_TOKEN, OWNERS, XIAO_PREFIX, INVITE } = process.env;
|
||||
const path = require('path');
|
||||
const { CommandoClient } = require('discord.js-commando');
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
const { KAIROS_KEY, KAIROS_ID } = process.env;
|
||||
const races = ['asian', 'black', 'hispanic', 'other', 'white'];
|
||||
|
||||
module.exports = class FaceAnalyzeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'face-analyze',
|
||||
aliases: ['analyze-face', 'face'],
|
||||
group: 'analyze',
|
||||
memberName: 'face',
|
||||
description: 'Determines the age, gender, and race of a face.',
|
||||
args: [
|
||||
{
|
||||
key: 'face',
|
||||
prompt: 'What face do you want to scan?',
|
||||
type: 'image'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { face }) {
|
||||
try {
|
||||
const { body } = await request
|
||||
.post('https://api.kairos.com/detect')
|
||||
.set({
|
||||
app_id: KAIROS_ID,
|
||||
app_key: KAIROS_KEY
|
||||
})
|
||||
.send({ image: face });
|
||||
if (!body.images) return msg.reply('There are no faces in this image.');
|
||||
if (body.images[0].faces.length > 1) return msg.reply('Please provide only one face in the image.');
|
||||
const data = body.images[0].faces[0].attributes;
|
||||
const race = races.sort((a, b) => data[b] - data[a])[0];
|
||||
const gender = data.gender.maleConfidence > data.gender.femaleConfidence ? 'man' : 'woman';
|
||||
return msg.reply(`I think this is a photo of a ${data.age} year old ${race} ${gender}.`);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -50,7 +50,7 @@ module.exports = class WhatAnimeCommand extends Command {
|
||||
.query({ token: WHATANIME_KEY });
|
||||
return { status: body.quota > 0, refresh: body.quota_ttl };
|
||||
} catch (err) {
|
||||
return { status: false, refresh: null };
|
||||
return { status: false, refresh: Infinity };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
|
||||
module.exports = class MemeCommand extends Command {
|
||||
module.exports = class CreateMemeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'meme',
|
||||
name: 'create-meme',
|
||||
aliases: ['meme-generator', 'meme-gen'],
|
||||
group: 'image-edit',
|
||||
memberName: 'meme',
|
||||
memberName: 'create-meme',
|
||||
description: 'Sends a meme with the text and background of your choice.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
args: [
|
||||
@@ -1,5 +1,6 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const request = require('node-superfetch');
|
||||
const { IMGUR_KEY, FIDGET_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class FidgetCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -11,14 +12,28 @@ module.exports = class FidgetCommand extends Command {
|
||||
description: 'Responds with a random image of Fidget.',
|
||||
clientPermissions: ['ATTACH_FILES']
|
||||
});
|
||||
|
||||
this.cache = null;
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
try {
|
||||
const nimbat = await randomFromImgurAlbum('DuO1T');
|
||||
const nimbat = await this.random();
|
||||
if (!nimbat) return msg.reply('This album has no images...');
|
||||
return msg.say({ files: [nimbat] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
|
||||
async random() {
|
||||
if (this.cache) return this.cache[Math.floor(Math.random() * this.cache.length)].link;
|
||||
const { body } = await request
|
||||
.get(`https://api.imgur.com/3/album/${FIDGET_ALBUM_ID}`)
|
||||
.set({ Authorization: `Client-ID ${IMGUR_KEY}` });
|
||||
if (!body.data.images.length) return null;
|
||||
this.cache = body.data.images;
|
||||
setTimeout(() => { this.cache = null; }, 3.6e+6);
|
||||
return body.data.images[Math.floor(Math.random() * body.data.images.length)].link;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
const { IMGUR_KEY, POSTER_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class MemeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'meme',
|
||||
group: 'random',
|
||||
memberName: 'meme',
|
||||
description: 'Responds with a random meme.',
|
||||
clientPermissions: ['ATTACH_FILES']
|
||||
});
|
||||
|
||||
this.cache = null;
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
try {
|
||||
const meme = await this.random();
|
||||
if (!meme) return msg.reply('This album has no images...');
|
||||
return msg.say({ files: [meme] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
|
||||
async random() {
|
||||
if (this.cache) return this.cache[Math.floor(Math.random() * this.cache.length)].link;
|
||||
const { body } = await request
|
||||
.get(`https://api.imgur.com/3/album/${POSTER_ALBUM_ID}`)
|
||||
.set({ Authorization: `Client-ID ${IMGUR_KEY}` });
|
||||
if (!body.data.images.length) return null;
|
||||
this.cache = body.data.images;
|
||||
setTimeout(() => { this.cache = null; }, 3.6e+6);
|
||||
return body.data.images[Math.floor(Math.random() * body.data.images.length)].link;
|
||||
}
|
||||
};
|
||||
@@ -1,24 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
|
||||
module.exports = class PikachuCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'pikachu',
|
||||
aliases: ['pika'],
|
||||
group: 'random',
|
||||
memberName: 'pikachu',
|
||||
description: 'Responds with a random image of Pikachu.',
|
||||
clientPermissions: ['ATTACH_FILES']
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
try {
|
||||
const pikachu = await randomFromImgurAlbum('qtk2J');
|
||||
return msg.say({ files: [pikachu] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
+17
-2
@@ -1,5 +1,6 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const request = require('node-superfetch');
|
||||
const { IMGUR_KEY, XIAO_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class XiaoCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -11,14 +12,28 @@ module.exports = class XiaoCommand extends Command {
|
||||
description: 'Responds with a random image of Xiao Pai.',
|
||||
clientPermissions: ['ATTACH_FILES']
|
||||
});
|
||||
|
||||
this.cache = null;
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
try {
|
||||
const xiao = await randomFromImgurAlbum('S4e3r');
|
||||
const xiao = await this.random();
|
||||
if (!xiao) return msg.reply('This album has no images...');
|
||||
return msg.say({ files: [xiao] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
|
||||
async random() {
|
||||
if (this.cache) return this.cache[Math.floor(Math.random() * this.cache.length)].link;
|
||||
const { body } = await request
|
||||
.get(`https://api.imgur.com/3/album/${XIAO_ALBUM_ID}`)
|
||||
.set({ Authorization: `Client-ID ${IMGUR_KEY}` });
|
||||
if (!body.data.images.length) return null;
|
||||
this.cache = body.data.images;
|
||||
setTimeout(() => { this.cache = null; }, 3.6e+6);
|
||||
return body.data.images[Math.floor(Math.random() * body.data.images.length)].link;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { BREAK_UP_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class BreakUpCommand extends Command {
|
||||
module.exports = class BreakUpCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'break-up',
|
||||
@@ -9,6 +9,8 @@ module.exports = class BreakUpCommand extends Command {
|
||||
group: 'roleplay',
|
||||
memberName: 'break-up',
|
||||
description: 'Breaks up with a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: BREAK_UP_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -19,12 +21,7 @@ module.exports = class BreakUpCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('QFWUb');
|
||||
return msg.say(`_**${msg.author.username}** breaks up with **${user.username}**._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** breaks up with **${user.username}**._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { BRO_HOOF_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class BroHoofCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'bro-hoof',
|
||||
group: 'roleplay',
|
||||
memberName: 'bro-hoof',
|
||||
description: 'Gives a user a bro-hoof.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: BRO_HOOF_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'What user do you want to roleplay with?',
|
||||
type: 'user'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** gives **${user.username}** a bro-hoof._`;
|
||||
}
|
||||
};
|
||||
@@ -1,13 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { CUDDLE_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class CuddleCommand extends Command {
|
||||
module.exports = class CuddleCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'cuddle',
|
||||
group: 'roleplay',
|
||||
memberName: 'cuddle',
|
||||
description: 'Cuddles a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: CUDDLE_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -18,12 +20,7 @@ module.exports = class CuddleCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('sVjXp');
|
||||
return msg.say(`_**${msg.author.username}** cuddles with **${user.username}**._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** cuddles with **${user.username}**._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { EAT_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class EatCommand extends Command {
|
||||
module.exports = class EatCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'eat',
|
||||
group: 'roleplay',
|
||||
memberName: 'eat',
|
||||
description: 'Eats a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: EAT_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -18,12 +20,7 @@ module.exports = class EatCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('GP2zD');
|
||||
return msg.say(`_**${msg.author.username}** eats **${user.username}**._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** eats **${user.username}**._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { EVOLVE_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class EvolveCommand extends Command {
|
||||
module.exports = class EvolveCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'evolve',
|
||||
group: 'roleplay',
|
||||
memberName: 'evolve',
|
||||
description: 'Evolves a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: EVOLVE_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -18,12 +20,7 @@ module.exports = class EvolveCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('QaDeO');
|
||||
return msg.say(`_**${user.username}** is evolving!_`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${user.username}** is evolving!_`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { FALCON_PUNCH_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class FalconPunchCommand extends Command {
|
||||
module.exports = class FalconPunchCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'falcon-punch',
|
||||
group: 'roleplay',
|
||||
memberName: 'falcon-punch',
|
||||
description: 'Falcon Punches a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: FALCON_PUNCH_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -18,12 +20,7 @@ module.exports = class FalconPunchCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('mJauN');
|
||||
return msg.say(`_**${msg.author.username}** falcon punches **${user.username}**._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** falcon punches **${user.username}**._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { FIST_BUMP_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class FistBumpCommand extends Command {
|
||||
module.exports = class FistBumpCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'fist-bump',
|
||||
group: 'roleplay',
|
||||
memberName: 'fist-bump',
|
||||
description: 'Fistbumps a user.',
|
||||
description: 'Fist-bumps a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: FIST_BUMP_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -18,12 +20,7 @@ module.exports = class FistBumpCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('9D3WE');
|
||||
return msg.say(`_**${msg.author.username}** fist-bumps **${user.username}**._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** fist-bumps **${user.username}**._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { HIGH_FIVE_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class HighFiveCommand extends Command {
|
||||
module.exports = class HighFiveCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'high-five',
|
||||
group: 'roleplay',
|
||||
memberName: 'high-five',
|
||||
description: 'High Fives a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: HIGH_FIVE_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -18,12 +20,7 @@ module.exports = class HighFiveCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('1Dotc');
|
||||
return msg.say(`_**${msg.author.username}** high-fives **${user.username}**._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** high-fives **${user.username}**._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { HIT_WITH_SHOVEL_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class HitWithShovelCommand extends Command {
|
||||
module.exports = class HitWithShovelCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'hit-with-shovel',
|
||||
group: 'roleplay',
|
||||
memberName: 'hit-with-shovel',
|
||||
description: 'Hits a user with a shovel.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: HIT_WITH_SHOVEL_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -18,12 +20,7 @@ module.exports = class HitWithShovelCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('IA35f');
|
||||
return msg.say(`_**${msg.author.username}** hits **${user.username}** with a shovel._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** hits **${user.username}** with a shovel._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { HOLD_HANDS_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class HoldHandsCommand extends Command {
|
||||
module.exports = class HoldHandsCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'hold-hands',
|
||||
@@ -9,6 +9,8 @@ module.exports = class HoldHandsCommand extends Command {
|
||||
group: 'roleplay',
|
||||
memberName: 'hold-hands',
|
||||
description: 'Holds hands with a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: HOLD_HANDS_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -19,12 +21,7 @@ module.exports = class HoldHandsCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('K67Lp');
|
||||
return msg.say(`_**${msg.author.username}** holds **${user.username}**'s hand._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** holds **${user.username}**'s hand._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { HUG_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class HugCommand extends Command {
|
||||
module.exports = class HugCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'hug',
|
||||
group: 'roleplay',
|
||||
memberName: 'hug',
|
||||
description: 'Hugs a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: HUG_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -18,12 +20,7 @@ module.exports = class HugCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('v4Sdd');
|
||||
return msg.say(`_**${msg.author.username}** hugs **${user.username}**._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** hugs **${user.username}**._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { INHALE_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class InhaleCommand extends Command {
|
||||
module.exports = class InhaleCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'inhale',
|
||||
group: 'roleplay',
|
||||
memberName: 'inhale',
|
||||
description: 'Inhales a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: INHALE_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -18,15 +20,7 @@ module.exports = class InhaleCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('QKFM6');
|
||||
return msg.say(
|
||||
`_**${msg.author.username}** inhales **${user.username}** but gained no ability..._`,
|
||||
{ files: [gif] }
|
||||
);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** inhales **${user.username}** but gained no ability..._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { KILL_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class KillCommand extends Command {
|
||||
module.exports = class KillCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'kill',
|
||||
group: 'roleplay',
|
||||
memberName: 'kill',
|
||||
description: 'Kills a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: KILL_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -18,12 +20,7 @@ module.exports = class KillCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('YhwEI');
|
||||
return msg.say(`_**${msg.author.username}** kills **${user.username}**._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** kills **${user.username}**._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { KISS_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class KissCommand extends Command {
|
||||
module.exports = class KissCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'kiss',
|
||||
group: 'roleplay',
|
||||
memberName: 'kiss',
|
||||
description: 'Kisses a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: KISS_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -18,12 +20,7 @@ module.exports = class KissCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('twIbD');
|
||||
return msg.say(`_**${msg.author.username}** kisses **${user.username}**._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** kisses **${user.username}**._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { MARRY_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class MarryCommand extends Command {
|
||||
module.exports = class MarryCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'marry',
|
||||
group: 'roleplay',
|
||||
memberName: 'marry',
|
||||
description: 'Marries a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: MARRY_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -18,12 +20,7 @@ module.exports = class MarryCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('4H0EP');
|
||||
return msg.say(`_**${msg.author.username}** marries **${user.username}**._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** marries **${user.username}**._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { PAT_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class PatCommand extends Command {
|
||||
module.exports = class PatCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'pat',
|
||||
group: 'roleplay',
|
||||
memberName: 'pat',
|
||||
description: 'Pats a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: PAT_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -18,12 +20,7 @@ module.exports = class PatCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('JPwZG');
|
||||
return msg.say(`_**${msg.author.username}** pats **${user.username}**._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** pats **${user.username}**._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { POKE_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class PokeCommand extends Command {
|
||||
module.exports = class PokeCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'poke',
|
||||
group: 'roleplay',
|
||||
memberName: 'poke',
|
||||
description: 'Pokes a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: POKE_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -18,12 +20,7 @@ module.exports = class PokeCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('ek91V');
|
||||
return msg.say(`_**${msg.author.username}** pokes **${user.username}**._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** pokes **${user.username}**._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { PUNCH_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class PunchCommand extends Command {
|
||||
module.exports = class PunchCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'punch',
|
||||
group: 'roleplay',
|
||||
memberName: 'punch',
|
||||
description: 'Punches a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: PUNCH_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -18,12 +20,7 @@ module.exports = class PunchCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('mZrp8');
|
||||
return msg.say(`_**${msg.author.username}** punches **${user.username}**._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** punches **${user.username}**._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { PUNCH_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class SlapCommand extends Command {
|
||||
module.exports = class SlapCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'slap',
|
||||
group: 'roleplay',
|
||||
memberName: 'slap',
|
||||
description: 'Slaps a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: PUNCH_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -18,12 +20,7 @@ module.exports = class SlapCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('6wu9G');
|
||||
return msg.say(`_**${msg.author.username}** slaps **${user.username}**._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** slaps **${user.username}**._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { randomFromImgurAlbum } = require('../../util/Util');
|
||||
const RoleplayCommand = require('../../structures/commands/Roleplay');
|
||||
const { TACKLE_ALBUM_ID } = process.env;
|
||||
|
||||
module.exports = class TackleCommand extends Command {
|
||||
module.exports = class TackleCommand extends RoleplayCommand {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'tackle',
|
||||
@@ -9,6 +9,8 @@ module.exports = class TackleCommand extends Command {
|
||||
group: 'roleplay',
|
||||
memberName: 'tackle',
|
||||
description: 'Tackles a user.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
albumID: TACKLE_ALBUM_ID,
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
@@ -19,12 +21,7 @@ module.exports = class TackleCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const gif = await randomFromImgurAlbum('SZGLX');
|
||||
return msg.say(`_**${msg.author.username}** tackles **${user.username}**._`, { files: [gif] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
generateText(msg, user) {
|
||||
return `_**${msg.author.username}** tackles **${user.username}**._`;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -70,7 +70,7 @@ module.exports = class LeagueOfLegendsChampionCommand extends Command {
|
||||
.get('https://na1.api.riotgames.com/lol/static-data/v3/versions')
|
||||
.query({ api_key: RIOT_KEY });
|
||||
[this.version] = body;
|
||||
setTimeout(() => { this.version = null; }, 3600000);
|
||||
setTimeout(() => { this.version = null; }, 3.6e+6);
|
||||
return body;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,6 @@ module.exports = class EatPantCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say({ files: ['https://i.imgur.com/sSmhvxt.jpg'] });
|
||||
return msg.say({ files: ['https://i.imgur.com/uEk0kI4.jpg'] });
|
||||
}
|
||||
};
|
||||
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "87.5.1",
|
||||
"version": "88.0.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
@@ -39,6 +39,7 @@
|
||||
"custom-translate": "^2.2.6",
|
||||
"discord.js": "github:discordjs/discord.js",
|
||||
"discord.js-commando": "github:discordjs/Commando",
|
||||
"dotenv": "^6.0.0",
|
||||
"erlpack": "github:discordapp/erlpack",
|
||||
"mathjs": "^5.1.1",
|
||||
"neopet-image-finder": "^4.0.0",
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
const request = require('node-superfetch');
|
||||
const Command = require('../Command');
|
||||
const { IMGUR_KEY } = process.env;
|
||||
|
||||
module.exports = class RoleplayCommand extends Command {
|
||||
constructor(client, info) {
|
||||
super(client, info);
|
||||
|
||||
this.albumID = info.albumID;
|
||||
this.cache = null;
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const image = await this.random();
|
||||
if (!image) return msg.reply('This album has no images...');
|
||||
return msg.say(this.generateText(msg, user), { files: [image] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
|
||||
async random() {
|
||||
if (this.cache) return this.cache[Math.floor(Math.random() * this.cache.length)].link;
|
||||
const { body } = await request
|
||||
.get(`https://api.imgur.com/3/album/${this.albumID}`)
|
||||
.set({ Authorization: `Client-ID ${IMGUR_KEY}` });
|
||||
if (!body.data.images.length) return null;
|
||||
this.cache = body.data.images;
|
||||
setTimeout(() => { this.cache = null; }, 3.6e+6);
|
||||
return body.data.images[Math.floor(Math.random() * body.data.images.length)].link;
|
||||
}
|
||||
};
|
||||
+3
-12
@@ -1,8 +1,7 @@
|
||||
const request = require('node-superfetch');
|
||||
const crypto = require('crypto');
|
||||
const { IMGUR_KEY, SUCCESS_EMOJI_ID } = process.env;
|
||||
const yes = ['yes', 'y', 'ye', 'yeah', 'yup', 'yea'];
|
||||
const no = ['no', 'n', 'nah', 'nope'];
|
||||
const { SUCCESS_EMOJI_ID } = process.env;
|
||||
const yes = ['yes', 'y', 'ye', 'yeah', 'yup', 'yea', 'ya'];
|
||||
const no = ['no', 'n', 'nah', 'nope', 'nop'];
|
||||
|
||||
module.exports = class Util {
|
||||
static delay(ms) {
|
||||
@@ -59,14 +58,6 @@ module.exports = class Util {
|
||||
return crypto.createHash(algorithm).update(text).digest('hex');
|
||||
}
|
||||
|
||||
static async randomFromImgurAlbum(album) {
|
||||
const { body } = await request
|
||||
.get(`https://api.imgur.com/3/album/${album}`)
|
||||
.set({ Authorization: `Client-ID ${IMGUR_KEY}` });
|
||||
if (!body.data.images.length) return null;
|
||||
return body.data.images[Math.floor(Math.random() * body.data.images.length)].link;
|
||||
}
|
||||
|
||||
static today(timeZone) {
|
||||
const now = new Date();
|
||||
if (timeZone) now.setUTCHours(now.getUTCHours() + timeZone);
|
||||
|
||||
Reference in New Issue
Block a user