import { text } from "@/utils/components"; import { type ChatInputCommandInteraction, type Client, SlashCommandBuilder, } from "discord.js"; import Uwuifier from "uwuifier"; const commandData = new SlashCommandBuilder() .setName("meow") .setDescription("mrrp~") .addStringOption((option) => option .setName("text") .setDescription("The text to meowify") .setRequired(true), ); const meowVariants = [ "meow", "mew", "mrrow", "mrow", "mrrp", "miau", "miu", "nya", "mya", "mraow", "meowdy", "mrrr", "prrt", "prrp", "mreow", "mweow", "mwow", "mrrah", "mrawr", ]; const suffixes = ["~", "!!", "!?", "?!", "...", "!11", ""]; const prefixes = ["m-", "", ""]; const emoticons = [">w<", "^w^", "=^w^=", "ฅ^•ﻌ•^ฅ", "(=^・ェ・^=)", ""]; function meowify(input: string): string { const words = input.toLowerCase().split(/\s+/); return ( words .map((word) => { const prefix = prefixes[Math.floor(Math.random() * prefixes.length)]; const meow = meowVariants[Math.floor(Math.random() * meowVariants.length)]; const suffix = suffixes[Math.floor(Math.random() * suffixes.length)]; // sometimes extend the meow with repeated letters const extendedMeow = Math.random() > 0.6 ? meow.replace(/[aeiouw]/g, (m) => m.repeat(Math.floor(Math.random() * 3) + 1), ) : meow; return `${prefix}${extendedMeow}${suffix}`; }) .join(" ") + (Math.random() > 0.7 ? ` ${emoticons[Math.floor(Math.random() * emoticons.length)]}` : "") ); } async function execute( _client: Client, interaction: ChatInputCommandInteraction, ) { const uwuifier = new Uwuifier(); const text = interaction.options.getString("text", true); const meowifiedText = meowify(text); const uwuifiedMeowText = uwuifier.uwuifySentence(meowifiedText); const blacklistedWords = [ "twerks", "sees bulge", "notices buldge", "starts twerking", ]; const finalText = blacklistedWords.reduce((acc, word) => { return acc.replace(new RegExp(word, "gi"), "----"); }, uwuifiedMeowText); await interaction.reply({ content: finalText, allowedMentions: { users: [interaction.user.id] }, }); } export default { data: commandData, execute, };