mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-19 13:56:43 +02:00
Move to snekfetch 🐍
This commit is contained in:
@@ -1,47 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const translator = require('custom-translate');
|
||||
const morse = {
|
||||
"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": "----.",
|
||||
".": ".-.-.-",
|
||||
"?": "..--..",
|
||||
",": "--..--",
|
||||
"'": ".----."
|
||||
};
|
||||
const { dictionary } = require('./morsemappings.json');
|
||||
|
||||
module.exports = class MorseCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -59,7 +18,7 @@ module.exports = class MorseCommand extends Command {
|
||||
prompt: 'What text would you like to convert to morse?',
|
||||
type: 'string',
|
||||
validate: content => {
|
||||
if (translator.letterTrans(content, morse, ' ').length < 1900) {
|
||||
if (translator.letterTrans(content, dictionary, ' ').length < 1900) {
|
||||
return true;
|
||||
}
|
||||
return 'Your text to encode is too long.';
|
||||
@@ -73,7 +32,7 @@ module.exports = class MorseCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
const text = args.text.toLowerCase();
|
||||
const encoded = translator.letterTrans(text, morse, ' ');
|
||||
const encoded = translator.letterTrans(text, dictionary, ' ');
|
||||
return message.say(encoded);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user