mirror of
https://github.com/arthur-pbty/bot-discord-coins.git
synced 2026-06-20 05:41:47 +02:00
53 lines
1.4 KiB
JavaScript
53 lines
1.4 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))
|
|
}
|
|
}; |