-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import Command from '../types/Command'; | ||
import { CommandInteraction } from 'discord.js'; | ||
import { SlashCommandBuilder } from '@discordjs/builders'; | ||
|
||
const funnyfont: Command = { | ||
data: new SlashCommandBuilder() | ||
.setName('funnyfont') | ||
.addStringOption(option => | ||
option.setName("text") | ||
.setDescription("The text to make into funny font") | ||
.setRequired(true) | ||
) | ||
.addStringOption(option => | ||
option.setName("font") | ||
.setDescription("The font to choose") | ||
.setRequired(false) | ||
.addChoices( | ||
{ name: "cool edgy", value: "cooledgy" }, | ||
{ name: "cursive", value: "cursive" } | ||
) | ||
) | ||
.setDescription('Makes text into a funny font'), | ||
|
||
execute: async function (interaction: CommandInteraction<'cached' | 'raw'>): Promise<void> { | ||
const text = interaction.options.getString("text", true); | ||
const font = interaction.options.getString("font", false) || "cooledgy"; | ||
|
||
let lowerCaseOut: Array<string>; | ||
let upperCaseOut: Array<string>; | ||
|
||
// abcdefghijklmnopqrstuvwxyz | ||
// ABCDEFGHIJKLMNOPQRSTUVWXYZ | ||
// 0123456789 | ||
|
||
let outputText = ""; | ||
|
||
if (font === "cooledgy") { | ||
lowerCaseOut = ['๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐']; | ||
upperCaseOut = ['๐ฌ', '๐ญ', '๐ฎ', '๐ฏ', '๐ฐ', '๐ฑ', '๐ฒ', '๐ณ', '๐ด', '๐ต', '๐ถ', '๐ท', '๐ธ', '๐น', '๐บ', '๐ป', '๐ผ', '๐ฝ', '๐พ', '๐ฟ', '๐', '๐', '๐', '๐', '๐', '๐ ']; | ||
} | ||
else if (font === "cursive") { | ||
lowerCaseOut = ['๐ช', '๐ซ', '๐ฌ', '๐ญ', '๐ฎ', '๐ฏ', '๐ฐ', '๐ฑ', '๐ฒ', '๐ณ', '๐ด', '๐ต', '๐ถ', '๐ท', '๐ธ', '๐น', '๐บ', '๐ป', '๐ผ', '๐ฝ', '๐พ', '๐ฟ', '๐', '๐', '๐', '๐']; | ||
upperCaseOut = ['๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐ ', '๐ก', '๐ข', '๐ฃ', '๐ค', '๐ฅ', '๐ฆ', '๐ง', '๐จ', '๐ฉ']; | ||
} | ||
else{ | ||
return; | ||
} | ||
|
||
for(let i=0; i<text.length; i++){ | ||
if (!/[a-zA-Z]/.test(text[i])){ | ||
outputText += text[i]; | ||
continue; | ||
} | ||
|
||
const position = text[i].toUpperCase().charCodeAt(0) - 'A'.charCodeAt(0); | ||
const isUpper = text[i] === text[i].toUpperCase(); | ||
if (isUpper){ | ||
outputText += upperCaseOut[position]; | ||
} | ||
else{ | ||
outputText += lowerCaseOut[position]; | ||
} | ||
} | ||
|
||
interaction.reply({ content: outputText }); | ||
} | ||
} | ||
|
||
export default funnyfont; |