diff --git a/assets/json/finger-binary.json b/assets/json/finger-binary.json new file mode 100644 index 00000000..040e0a21 --- /dev/null +++ b/assets/json/finger-binary.json @@ -0,0 +1,32 @@ +{ + "00001": ":thumbsup:", + "00010": "<:00010:317020047405088768>", + "00011": "<:00011:317020047208087553>", + "00100": "<:00100:317020047417802762>", + "00101": "<:00101:317020047157755905>", + "00110": ":v:", + "00111": "<:00111:317020222336794624>", + "01000": "<:01000:317020047358951454>", + "01001": "<:01001:317020047056961537>", + "01010": "<:01010:317020046964555778>", + "01011": "<:01011:317020047249768449>", + "01101": "<:01101:317020046947778561>", + "01110": "<:01110:317020047367208961>", + "01111": "<:01111:317020047367340033>", + "10000": "<:10000:317020047853879296>", + "10001": "<:10001:317020047383986186>", + "10010": "<:10010:317020046939389963>", + "10011": "<:10011:317022879004884992>", + "10100": "<:10100:317020047383986176>", + "10101": "<:10101:317020046134345728>", + "10110": "<:10110:317020046121631754>", + "10111": "<:10111:317020046365032451>", + "11000": "<:11000:317020046473822208>", + "11001": "<:11001:317020046318764032>", + "11010": "<:11010:317020046750777347>", + "11011": "<:11011:317020046285078530>", + "11100": "<:11100:317020046989983744>", + "11101": "<:11101:317020047367208970>", + "11110": "<:11110:317020045744275458>", + "11111": ":hand_splayed:" +} diff --git a/commands/textedit/finger-binary.js b/commands/textedit/finger-binary.js new file mode 100644 index 00000000..90893075 --- /dev/null +++ b/commands/textedit/finger-binary.js @@ -0,0 +1,38 @@ +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 { wordTrans } = require('custom-translate'); +const dictionary = require('../../assets/json/finger-binary'); + +module.exports = class FingerBinaryCommand extends Command { + constructor(client) { + super(client, { + name: 'finger-binary', + group: 'textedit', + memberName: 'finger-binary', + description: 'Converts text to finger binary.', + args: [ + { + key: 'text', + prompt: 'What text would you like to convert to finger binary?', + type: 'string', + validate: text => { + if (wordTrans(binary(text).match(/.{1,5}/g).join(' '), dictionary, '').length < 2000) return true; + return 'Your text is too long.'; + }, + parse: text => wordTrans(binary(text).match(/.{1,5}/g).join(' '), dictionary, '') + } + ] + }); + } + + run(msg, args) { + const { text } = args; + return msg.say(text); + } +}; diff --git a/html/carbonfeat.html b/html/carbonfeat.html index c6a5bb51..4fe4223a 100644 --- a/html/carbonfeat.html +++ b/html/carbonfeat.html @@ -54,7 +54,7 @@