Refactor roleplay commands, bro-hoof, meme, remove face, add dotenv support

This commit is contained in:
Daniel Odendahl Jr
2018-08-28 22:26:58 +00:00
parent 5f81ce16c3
commit a4518c05ce
35 changed files with 349 additions and 287 deletions
-43
View File
@@ -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!`);
}
}
};
+1 -1
View File
@@ -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: [
+17 -2
View File
@@ -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;
}
};
+38
View File
@@ -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;
}
};
-24
View File
@@ -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
View File
@@ -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;
}
};
+7 -10
View File
@@ -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}**._`;
}
};
+26
View File
@@ -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._`;
}
};
+7 -10
View File
@@ -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}**._`;
}
};
+7 -10
View File
@@ -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}**._`;
}
};
+7 -10
View File
@@ -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!_`;
}
};
+7 -10
View File
@@ -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}**._`;
}
};
+8 -11
View File
@@ -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}**._`;
}
};
+7 -10
View File
@@ -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}**._`;
}
};
+7 -10
View File
@@ -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._`;
}
};
+7 -10
View File
@@ -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._`;
}
};
+7 -10
View File
@@ -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}**._`;
}
};
+7 -13
View File
@@ -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..._`;
}
};
+7 -10
View File
@@ -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}**._`;
}
};
+7 -10
View File
@@ -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}**._`;
}
};
+7 -10
View File
@@ -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}**._`;
}
};
+7 -10
View File
@@ -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}**._`;
}
};
+7 -10
View File
@@ -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}**._`;
}
};
+7 -10
View File
@@ -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}**._`;
}
};
+7 -10
View File
@@ -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}**._`;
}
};
+7 -10
View File
@@ -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;
}
+1 -1
View File
@@ -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'] });
}
};