mirror of
https://github.com/SrIzan10/Recluse-Bot.git
synced 2026-05-01 10:55:24 +00:00
52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
module.exports = {
|
|
name: "emojify",
|
|
category: "fun",
|
|
description: "Changes text into emojis",
|
|
aliases: ["emify"],
|
|
usage: "emojify <text>",
|
|
run: async (client, message, args) => {
|
|
if (!args[0]) {
|
|
return message.channel.send("Please provide valid text.");
|
|
}
|
|
|
|
const specialChars = {
|
|
0: ":zero:",
|
|
1: ":one:",
|
|
2: ":two:",
|
|
3: ":three:",
|
|
4: ":four:",
|
|
5: ":five:",
|
|
6: ":six:",
|
|
7: ":seven:",
|
|
8: ":eight:",
|
|
9: ":nine:",
|
|
"#": ":hash:",
|
|
"*": ":asterisk:",
|
|
"?": ":grey_question:",
|
|
"!": ":grey_exclamation:",
|
|
" ": " ",
|
|
};
|
|
|
|
const emojified = `${args.join(" ")}`
|
|
.toLowerCase()
|
|
.split("")
|
|
.map((letter) => {
|
|
if (/[a-z]/g.test(letter)) {
|
|
return `:regional_indicator_${letter}: `;
|
|
} else if (specialChars[letter]) {
|
|
return `${specialChars[letter]} `;
|
|
}
|
|
return letter;
|
|
})
|
|
.join("");
|
|
|
|
if (emojified.length > 2000) {
|
|
return message.channel.send(
|
|
"The emojified message exceeds 2000 characters."
|
|
);
|
|
}
|
|
|
|
message.channel.send(emojified);
|
|
},
|
|
};
|