amtixdev-morse-code
Version:
Discord Fun Morse Code For Discord Bots
60 lines (45 loc) • 2.4 kB
Markdown
<div align="center">
<br />
<p>
<a href="https://amtixdev.xyz"><img src="https://cdn.discordapp.com/attachments/1141443355532873879/1173692642551402608/mybanner-o-x_1.png?ex=6564e174&is=65526c74&hm=4939339c5671e01c6cdd068fb581b1fe88bd9b1c8fe56142caa4f51953cc7237&" width="546" alt="amtixdev-morse-code" /></a>
</p>
<p>
<a href="https://discord.gg/vSGYNqVNcG"><img src="https://img.shields.io/discord/1144745233704308861?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
<a href="https://www.npmjs.com/package/amtixdev-morse-code"><img src="https://img.shields.io/npm/v/amtixdev-morse-code?maxAge=3600" alt="NPM version" /></a>
<a href="https://www.npmjs.com/package/amtixdev-morse-code"><img src="https://img.shields.io/npm/dt/amtixdev-morse-code?maxAge=3600" alt="NPM downloads" /></a>
</p>
<p>
<a href="https://amtixdev.xyz"><img src="https://cdn.discordapp.com/attachments/1148318536062742648/1180978797193990275/Powered_By_AmtiXDev_With_Color.png?ex=657f6336&is=656cee36&hm=0828041d09f451ead489b244b10099ba1bd97fa6becffdca1d8e2315ccb2df35&" alt="AmtiXDev" /></a>
</p>
</div>
```js
npm install amtixdev-morse-code
```
```js
const { textToMorse, morseToText } = require('amtixdev-morse-code');
client.on('messageCreate', (message) => {
if (message.author.bot) return; // Ignore messages from other bots
const args = message.content.split(' ');
const command = args[0].toLowerCase();
if (command === '!morse') {
// Convert text to Morse code
const text = args.slice(1).join(' ');
const morse = textToMorse(text);
message.channel.send(`Morse code: ${morse}`);
}
if (command === '!decode') {
// Decode Morse code to text
const morse = args.slice(1).join(' ');
const text = morseToText(morse);
message.channel.send(`Decoded message: ${text}`);
}
});
```

If You Need Help About How The Npm Package Work? Contant Me [HERE](https://discord.gg/amtix-1k-1097821881245126768)
All rights reserved to [AmtiXDev](https://amtixdev.xyz)