Clean-Ups

This commit is contained in:
Daniel Odendahl Jr
2017-05-31 04:41:01 +00:00
parent 21ebcf8537
commit 7802bb49cb
142 changed files with 351 additions and 495 deletions
+10 -10
View File
@@ -1,11 +1,4 @@
const { Command } = require('discord.js-commando');
const binary = (str) => {
return unescape(encodeURIComponent(str))
.split('').map(str => {
const binary = str.charCodeAt(0).toString(2);
return `${'00000000'.slice(binary.length)}${binary}`;
}).join('');
};
const Command = require('../../structures/Command');
module.exports = class BinaryCommand extends Command {
constructor(client) {
@@ -20,10 +13,10 @@ module.exports = class BinaryCommand extends Command {
prompt: 'What text would you like to convert to binary?',
type: 'string',
validate: text => {
if (binary(text).length < 2000) return true;
if (this.binary(text).length < 2000) return true;
return 'Your text is too long.';
},
parse: text => binary(text)
parse: text => this.binary(text)
}
]
});
@@ -33,4 +26,11 @@ module.exports = class BinaryCommand extends Command {
const { text } = args;
return msg.say(text);
}
binary(text) {
return unescape(encodeURIComponent(text)).split('').map(str => {
const converted = str.charCodeAt(0).toString(2);
return `${'00000000'.slice(converted.length)}${converted}`;
}).join('');
}
};
+1 -1
View File
@@ -1,4 +1,4 @@
const { Command } = require('discord.js-commando');
const Command = require('../../structures/Command');
const { stripIndent } = require('common-tags');
module.exports = class CowsayCommand extends Command {
+2 -4
View File
@@ -1,4 +1,4 @@
const { Command } = require('discord.js-commando');
const Command = require('../../structures/Command');
const { RichEmbed } = require('discord.js');
module.exports = class EmbedCommand extends Command {
@@ -8,6 +8,7 @@ module.exports = class EmbedCommand extends Command {
group: 'textedit',
memberName: 'embed',
description: 'Sends a message in an embed.',
clientPermissions: ['EMBED_LINKS'],
args: [
{
key: 'text',
@@ -19,9 +20,6 @@ module.exports = class EmbedCommand extends Command {
}
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 { text } = args;
const embed = new RichEmbed()
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
+1 -1
View File
@@ -1,4 +1,4 @@
const { Command } = require('discord.js-commando');
const Command = require('../../structures/Command');
const { letterTrans } = require('custom-translate');
const dictionary = require('../../assets/json/morse');
+1 -1
View File
@@ -1,4 +1,4 @@
const { Command } = require('discord.js-commando');
const Command = require('../../structures/Command');
const { wordTrans } = require('custom-translate');
const dictionary = require('../../assets/json/pirate');
+1 -1
View File
@@ -1,4 +1,4 @@
const { Command } = require('discord.js-commando');
const Command = require('../../structures/Command');
module.exports = class RepeatCommand extends Command {
constructor(client) {
+1 -1
View File
@@ -1,4 +1,4 @@
const { Command } = require('discord.js-commando');
const Command = require('../../structures/Command');
module.exports = class ReverseCommand extends Command {
constructor(client) {
+2 -3
View File
@@ -1,4 +1,4 @@
const { Command } = require('discord.js-commando');
const Command = require('../../structures/Command');
module.exports = class SayCommand extends Command {
constructor(client) {
@@ -9,6 +9,7 @@ module.exports = class SayCommand extends Command {
memberName: 'say',
description: 'Make XiaoBot say what you wish.',
guildOnly: true,
clientPermissions: ['MANAGE_MESSAGES'],
args: [
{
key: 'text',
@@ -20,8 +21,6 @@ module.exports = class SayCommand extends Command {
}
run(msg, args) {
if (!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES'))
return msg.say('This Command requires the `Manage Messages` Permission.');
const { text } = args;
msg.delete();
return msg.say(`\u180E${text}`);
+1 -1
View File
@@ -1,4 +1,4 @@
const { Command } = require('discord.js-commando');
const Command = require('../../structures/Command');
const { wordTrans } = require('custom-translate');
const dictionary = require('../../assets/json/temmie');
+2 -4
View File
@@ -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 codes = require('../../assets/json/translate');
@@ -12,6 +12,7 @@ module.exports = class TranslateCommand extends Command {
memberName: 'translate',
description: 'Translates text to a specified language.',
details: '**Codes:** https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/#languages',
clientPermissions: ['EMBED_LINKS'],
args: [
{
key: 'text',
@@ -44,9 +45,6 @@ module.exports = class TranslateCommand 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 { text, to, from } = args;
try {
const { body } = await snekfetch
+1 -1
View File
@@ -1,4 +1,4 @@
const { Command } = require('discord.js-commando');
const Command = require('../../structures/Command');
const { letterTrans } = require('custom-translate');
const dictionary = require('../../assets/json/upside-down');
+3 -3
View File
@@ -1,4 +1,4 @@
const { Command } = require('discord.js-commando');
const Command = require('../../structures/Command');
const snekfetch = require('snekfetch');
const { WEBHOOK_URL } = process.env;
@@ -11,6 +11,8 @@ module.exports = class WebhookCommand extends Command {
memberName: 'webhook',
description: 'Posts a message to the webhook defined in your `process.env`.',
guildOnly: true,
ownerOnly: true,
clientPermissions: ['MANAGE_MESSAGES'],
args: [
{
key: 'content',
@@ -26,8 +28,6 @@ module.exports = class WebhookCommand extends Command {
}
async run(msg, args) {
if (!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES'))
return msg.say('This Command requires the `Manage Messages` Permission.');
const { content } = args;
try {
msg.delete();
+1 -1
View File
@@ -1,4 +1,4 @@
const { Command } = require('discord.js-commando');
const Command = require('../../structures/Command');
const zalgo = require('zalgolize');
module.exports = class ZalgoCommand extends Command {