mirror of
https://github.com/arthur-pbty/bot-discord-coins.git
synced 2026-06-17 08:07:38 +02:00
53 lines
1.2 KiB
JavaScript
53 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))
|
|
}
|
|
}; |