mirror of
https://github.com/arthur-pbty/bot-discord-coins.git
synced 2026-06-03 15:07:20 +02:00
57 lines
1.2 KiB
JavaScript
57 lines
1.2 KiB
JavaScript
const { ButtonStyle, ButtonBuilder, ActionRowBuilder } = require("discord.js");
|
|
|
|
module.exports = {
|
|
aliases: ["unmorse"],
|
|
description: "Permet de dire un message sous le noms du bot",
|
|
emote: "💬",
|
|
utilisation: "<message>",
|
|
permission: 0,
|
|
|
|
async execute(message, args, client) {
|
|
message.delete();
|
|
const morseCode = {
|
|
".-": "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",
|
|
" ": " ",
|
|
};
|
|
|
|
const convertFromMorse = (str) => {
|
|
return str
|
|
.split(" ")
|
|
.map((el) => {
|
|
return morseCode[el] ? morseCode[el] : el;
|
|
})
|
|
.join("");
|
|
};
|
|
|
|
let msg = message.content;
|
|
msg = msg.replace("&unmorse ", "");
|
|
msg = msg.replace("&sayunmorse ", "");
|
|
message.channel.send(convertFromMorse(msg));
|
|
},
|
|
};
|