From c05718deb6e76530e161d96844403a5e0640e480 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Thu, 5 Oct 2017 19:13:27 +0000 Subject: [PATCH] Braille Command --- assets/json/braille.json | 75 +++++++++++++++++++++++++++++++++++ commands/text-edit/braille.js | 29 ++++++++++++++ package.json | 2 +- 3 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 assets/json/braille.json create mode 100644 commands/text-edit/braille.js diff --git a/assets/json/braille.json b/assets/json/braille.json new file mode 100644 index 00000000..f157d3f7 --- /dev/null +++ b/assets/json/braille.json @@ -0,0 +1,75 @@ +{ + "a": "⠁", + "b": "⠃", + "c": "⠉", + "d": "⠙", + "e": "⠑", + "f": "⠋", + "g": "⠛", + "h": "⠓", + "i": "⠊", + "j": "⠚", + "k": "⠅", + "l": "⠇", + "m": "⠍", + "n": "⠝", + "o": "⠕", + "p": "⠏", + "q": "⠟", + "r": "⠗", + "s": "⠎", + "t": "⠞", + "u": "⠥", + "v": "⠧", + "w": "⠺", + "x": "⠭", + "y": "⠽", + "z": "⠵", + "A": "⠠⠁", + "B": "⠠⠃", + "C": "⠠⠉", + "D": "⠠⠙", + "E": "⠠⠑", + "F": "⠠⠋", + "G": "⠠⠛", + "H": "⠠⠓", + "I": "⠠⠊", + "J": "⠠⠚", + "K": "⠠⠅", + "L": "⠠⠇", + "M": "⠠⠍", + "N": "⠠⠝", + "O": "⠠⠕", + "P": "⠠⠏", + "Q": "⠠⠟", + "R": "⠠⠗", + "S": "⠠⠎", + "T": "⠠⠞", + "U": "⠠⠥", + "V": "⠠⠧", + "W": "⠠⠺", + "X": "⠠⠭", + "Y": "⠠⠽", + "Z": "⠠⠵", + "0": "⠼⠚", + "1": "⠼⠁", + "2": "⠼⠃", + "3": "⠼⠉", + "4": "⠼⠙", + "5": "⠼⠑", + "6": "⠼⠋", + "7": "⠼⠛", + "8": "⠼⠓", + "9": "⠼⠊", + ".": "⠲", + ",": "⠂", + "!": "⠖", + "?": "⠦", + "'": "⠄", + "\"": "⠄⠶", + ":": "⠒", + ";": "⠆", + "-": "⠤", + "(": "⠐⠣", + ")": "⠐⠜" +} diff --git a/commands/text-edit/braille.js b/commands/text-edit/braille.js new file mode 100644 index 00000000..9d38b14e --- /dev/null +++ b/commands/text-edit/braille.js @@ -0,0 +1,29 @@ +const { Command } = require('discord.js-commando'); +const { letterTrans } = require('custom-translate'); +const dictionary = require('../../assets/json/braille'); + +module.exports = class BrailleCommand extends Command { + constructor(client) { + super(client, { + name: 'braille', + group: 'text-edit', + memberName: 'braille', + description: 'Converts text to braille.', + args: [ + { + key: 'text', + prompt: 'What text would you like to convert to braille?', + type: 'string', + validate: text => { + if (letterTrans(text, dictionary).length < 2000) return true; + return 'Invalid text, your text is too long.'; + } + } + ] + }); + } + + run(msg, { text }) { + return msg.say(letterTrans(text, dictionary)); + } +}; diff --git a/package.json b/package.json index 57f6bc81..9413f4b1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "44.4.3", + "version": "44.5.0", "description": "Your personal server companion.", "main": "Shard.js", "scripts": {