mirror of
https://github.com/arthur-pbty/bot-discord-coins.git
synced 2026-06-03 23:36:29 +02:00
58 lines
1.2 KiB
JavaScript
58 lines
1.2 KiB
JavaScript
const { ButtonStyle, ButtonBuilder, ActionRowBuilder } = require("discord.js");
|
|
|
|
module.exports = {
|
|
aliases: ["morse"],
|
|
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 convertToMorse = (str) => {
|
|
return str
|
|
.toUpperCase()
|
|
.split("")
|
|
.map((el) => {
|
|
return morseCode[el] ? morseCode[el] : el;
|
|
})
|
|
.join("");
|
|
};
|
|
|
|
let msg = message.content;
|
|
msg = msg.replace("&morse ", "");
|
|
msg = msg.replace("&saymorse ", "");
|
|
message.channel.send(convertToMorse(msg));
|
|
},
|
|
};
|