2022-01-16 17:37:07 +00:00
|
|
|
|
import {SlashCommandBuilder} from "@discordjs/builders";
|
|
|
|
|
import {CommandInteraction} from "discord.js";
|
2021-04-13 12:38:52 +00:00
|
|
|
|
import {NamedCommand, RestCommand} from "onion-lasers";
|
2021-04-08 11:37:49 +00:00
|
|
|
|
const vaporwave = (() => {
|
|
|
|
|
const map = new Map<string, string>();
|
|
|
|
|
const vaporwave =
|
|
|
|
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!"#$%&'()*+,-./0123456789:;<=>?@[\]^_`{|}~ ";
|
|
|
|
|
const normal = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!\"#$%&'()*+,-./0123456789:;<=>?@[\\]^_`{|}~ ";
|
|
|
|
|
if (vaporwave.length !== normal.length) console.error("Vaporwave text failed to load properly!");
|
|
|
|
|
for (let i = 0; i < vaporwave.length; i++) map.set(normal[i], vaporwave[i]);
|
|
|
|
|
return map;
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
function getVaporwaveText(text: string): string {
|
|
|
|
|
let output = "";
|
|
|
|
|
|
|
|
|
|
for (const c of text) {
|
|
|
|
|
const transformed = vaporwave.get(c);
|
|
|
|
|
if (transformed) output += transformed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return output;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-16 17:37:07 +00:00
|
|
|
|
export const header = new SlashCommandBuilder()
|
|
|
|
|
.setDescription("Transforms your text into vaporwave.")
|
|
|
|
|
.addStringOption((option) =>
|
|
|
|
|
option.setName("text").setDescription("The text you want to vaporwave.").setRequired(true)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export async function handler(interaction: CommandInteraction) {
|
|
|
|
|
const {options} = interaction;
|
|
|
|
|
const response = options.getString("text", true);
|
|
|
|
|
await interaction.reply(getVaporwaveText(response));
|
|
|
|
|
}
|
2021-04-08 11:37:49 +00:00
|
|
|
|
export default new NamedCommand({
|
|
|
|
|
description: "Transforms your text into vaporwave.",
|
|
|
|
|
run: "You need to enter some text!",
|
2021-04-10 17:07:55 +00:00
|
|
|
|
any: new RestCommand({
|
2021-04-11 09:11:21 +00:00
|
|
|
|
async run({send, combined}) {
|
2021-04-10 17:07:55 +00:00
|
|
|
|
const text = getVaporwaveText(combined);
|
2021-04-10 13:34:55 +00:00
|
|
|
|
if (text !== "") send(text);
|
|
|
|
|
else send("Make sure to enter at least one valid character.");
|
2021-04-08 11:37:49 +00:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
});
|