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('');
}
};