mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 21:40:49 +02:00
Clean-Ups
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const Command = require('../../structures/Command');
|
||||
const Cleverbot = require('cleverio');
|
||||
const { CLEVS_KEY, CLEVS_USER, CLEVS_NICK } = process.env;
|
||||
|
||||
@@ -32,8 +32,7 @@ module.exports = class CleverbotCommand extends Command {
|
||||
msg.channel.startTyping();
|
||||
try {
|
||||
const { response } = await this.clevs.ask(text);
|
||||
return msg.reply(response)
|
||||
.then(() => msg.channel.stopTyping());
|
||||
return msg.reply(response).then(() => msg.channel.stopTyping());
|
||||
} catch (err) {
|
||||
return msg.say(`${err.name}: ${err.message}`);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const Command = require('../../structures/Command');
|
||||
const eastereggs = require('../../assets/json/easter-egg');
|
||||
|
||||
module.exports = class EasterEggCommand extends Command {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class GiveFlowerCommand extends Command {
|
||||
constructor(client) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const Command = require('../../structures/Command');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const signs = require('../../assets/json/horoscope');
|
||||
@@ -11,6 +11,7 @@ module.exports = class HoroscopeCommand extends Command {
|
||||
memberName: 'horoscope',
|
||||
description: 'Gives the horoscope for today for a particular sign.',
|
||||
details: `**Signs:** ${signs.join(', ')}`,
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'sign',
|
||||
@@ -27,9 +28,6 @@ module.exports = class HoroscopeCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { sign } = args;
|
||||
try {
|
||||
const { text } = await snekfetch
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class LennyCommand extends Command {
|
||||
constructor(client) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const Command = require('../../structures/Command');
|
||||
const codes = require('../../assets/json/meme');
|
||||
|
||||
module.exports = class MemeCommand extends Command {
|
||||
@@ -9,6 +9,7 @@ module.exports = class MemeCommand extends Command {
|
||||
memberName: 'meme',
|
||||
description: 'Sends a Meme with text of your choice, and a background of your choice.',
|
||||
details: `**Codes:** ${codes.join(', ')}`,
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
args: [
|
||||
{
|
||||
key: 'type',
|
||||
@@ -37,9 +38,6 @@ module.exports = class MemeCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||
const { type, top, bottom } = args;
|
||||
return msg.say({ files: [`https://memegen.link/${type}/${top}/${bottom}.jpg`] })
|
||||
.catch(err => msg.say(`${err.name}: ${err.message}`));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const Command = require('../../structures/Command');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const { stripIndents } = require('common-tags');
|
||||
|
||||
@@ -8,14 +8,12 @@ module.exports = class NitroCommand extends Command {
|
||||
name: 'nitro',
|
||||
group: 'random',
|
||||
memberName: 'nitro',
|
||||
description: 'Sends a "This Message Can Only be viewed by Nitro Members" message.'
|
||||
description: 'Sends a "This Message Can Only be viewed by Nitro Members" message.',
|
||||
clientPermissions: ['EMBED_LINKS']
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor('Discord Nitro')
|
||||
.setThumbnail('https://i.imgur.com/wzhMMnl.jpg')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const Command = require('../../structures/Command');
|
||||
const { names, paths } = require('../../assets/json/soundboard');
|
||||
const path = require('path');
|
||||
|
||||
@@ -16,6 +16,7 @@ module.exports = class SoundboardCommand extends Command {
|
||||
usages: 1,
|
||||
duration: 15
|
||||
},
|
||||
clientPermissions: ['ADD_REACTIONS'],
|
||||
args: [
|
||||
{
|
||||
key: 'sound',
|
||||
@@ -32,14 +33,12 @@ module.exports = class SoundboardCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('ADD_REACTIONS'))
|
||||
return msg.say('This Command requires the `Add Reactions` Permission.');
|
||||
const voiceChannel = msg.member.voiceChannel;
|
||||
if (!voiceChannel) return msg.say('Please enter a Voice Channel first.');
|
||||
if (!voiceChannel.permissionsFor(this.client.user).has('CONNECT'))
|
||||
return msg.say('This Command requires the `Connect` Permission.');
|
||||
return msg.say('This Command requires the `CONNECT` Permission.');
|
||||
if (!voiceChannel.permissionsFor(this.client.user).has('SPEAK'))
|
||||
return msg.say('This Command requires the `Speak` Permission.');
|
||||
return msg.say('This Command requires the `SPEAK` Permission.');
|
||||
if (!voiceChannel.joinable) return msg.say('This Voice Channel is not joinable.');
|
||||
const alreadyConnected = this.client.voiceConnections.get(voiceChannel.guild.id);
|
||||
if (alreadyConnected) return msg.say('I am already playing a sound.');
|
||||
@@ -47,7 +46,7 @@ module.exports = class SoundboardCommand extends Command {
|
||||
try {
|
||||
const connection = await voiceChannel.join();
|
||||
msg.react('🔊');
|
||||
const dispatcher = connection.playStream(path.join(__dirname, '..', '..', 'assets', 'sounds', paths[sound]));
|
||||
const dispatcher = connection.playFile(path.join(__dirname, '..', '..', 'assets', 'sounds', paths[sound]));
|
||||
dispatcher.on('end', () => {
|
||||
voiceChannel.leave();
|
||||
msg.react('✅');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const Command = require('../../structures/Command');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = class SpamCommand extends Command {
|
||||
@@ -7,14 +7,12 @@ module.exports = class SpamCommand extends Command {
|
||||
name: 'spam',
|
||||
group: 'random',
|
||||
memberName: 'spam',
|
||||
description: 'Puts a picture of Spam.'
|
||||
description: 'Puts a picture of Spam.',
|
||||
clientPermissions: ['ATTACH_FILES']
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||
return msg.say({ files: [path.join(__dirname, '..', '..', 'assets', 'images', 'spam.png')] })
|
||||
.catch(err => msg.say(`${err.name}: ${err.message}`));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const Command = require('../../structures/Command');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const moment = require('moment');
|
||||
|
||||
@@ -24,7 +24,7 @@ module.exports = class StarCommand extends Command {
|
||||
async run(msg, args, reaction) {
|
||||
const { id } = args;
|
||||
const channel = msg.guild.channels.get(msg.guild.settings.get('starboard'));
|
||||
if (!channel || !channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return null;
|
||||
if (!channel || !channel.permissionsFor(this.client.user).has(['SEND_MESSAGES', 'EMBED_LINKS'])) return null;
|
||||
if (this.starred.includes(id)) return null;
|
||||
try {
|
||||
const message = await msg.channel.fetchMessage(id);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const Command = require('../../structures/Command');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const Command = require('../../structures/Command');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
@@ -8,14 +8,12 @@ module.exports = class TodayCommand extends Command {
|
||||
name: 'today',
|
||||
group: 'random',
|
||||
memberName: 'today',
|
||||
description: 'Tells you what happened today in history.'
|
||||
description: 'Tells you what happened today in history.',
|
||||
clientPermissions: ['EMBED_LINKS']
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
try {
|
||||
const { text } = await snekfetch
|
||||
.get('http://history.muffinlabs.com/date');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const Command = require('../../structures/Command');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
@@ -9,14 +9,12 @@ module.exports = class WouldYouRatherCommand extends Command {
|
||||
aliases: ['wyrather'],
|
||||
group: 'random',
|
||||
memberName: 'would-you-rather',
|
||||
description: 'Gets a random would you rather question.'
|
||||
description: 'Gets a random would you rather question.',
|
||||
clientPermissions: ['EMBED_LINKS']
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
try {
|
||||
const { body } = await snekfetch
|
||||
.get('http://www.rrrather.com/botapi');
|
||||
|
||||
Reference in New Issue
Block a user