Cool pad thing

This commit is contained in:
Daniel Odendahl Jr
2017-10-13 20:41:05 +00:00
parent 19482a1a47
commit 1a377f55b5
5 changed files with 13 additions and 13 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
const { Command } = require('discord.js-commando');
const { pad } = require('../../structures/Util');
module.exports = class BinaryCommand extends Command {
constructor(client) {
@@ -28,7 +29,7 @@ module.exports = class BinaryCommand extends Command {
binary(text) {
return text.split('').map(str => {
const converted = str.charCodeAt(0).toString(2);
return `${'00000000'.slice(converted.length)}${converted}`;
return pad(converted, '00000000');
}).join('');
}
};