diff --git a/src/commands/botsex.ts b/src/commands/botsex.ts deleted file mode 100644 index 93d63cc..0000000 --- a/src/commands/botsex.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ApplicationCommandType, ContextMenuCommandBuilder, ContextMenuCommandInteraction, InteractionContextType, Snowflake, User } from "discord.js"; -import { ContextCommand } from "../command.ts"; - -export default class RailUser extends ContextCommand { - targetType: ApplicationCommandType.User = ApplicationCommandType.User; - contextDefinition: ContextMenuCommandBuilder = - new ContextMenuCommandBuilder() - .setName('rail') - .setType(ApplicationCommandType.User) - async run(interaction: ContextMenuCommandInteraction, target: User): Promise { - await interaction.reply(`Raililng <@${target.id}>.`) - await new Promise(resolve => setTimeout(resolve, 1000)) - await interaction.editReply(`UHGhghgghghgh. Railing successfull.`) - } -} \ No newline at end of file diff --git a/src/commands/mock.ts b/src/commands/mock.ts new file mode 100644 index 0000000..c97c57b --- /dev/null +++ b/src/commands/mock.ts @@ -0,0 +1,24 @@ +import { + ApplicationCommandType, + ContextMenuCommandBuilder, + ContextMenuCommandInteraction, + InteractionContextType, + Message, + Snowflake, + User +} from "discord.js"; +import { ContextCommand } from "../command.ts"; + +export default class Mock extends ContextCommand { + targetType: ApplicationCommandType.Message = ApplicationCommandType.Message; + contextDefinition: ContextMenuCommandBuilder = + new ContextMenuCommandBuilder() + .setName('mock') + .setType(ApplicationCommandType.Message) + async run(interaction: ContextMenuCommandInteraction, target: Message): Promise { + await interaction.deferReply(); + let message = target.content; + message = message.replace(/(.)(.)/g, (a,b,c)=>b.toLowerCase() + c.toUpperCase()) + await interaction.followUp(message); + } +} \ No newline at end of file diff --git a/src/commands/musicsearch.ts b/src/commands/musicsearch.ts new file mode 100644 index 0000000..3b0bc24 --- /dev/null +++ b/src/commands/musicsearch.ts @@ -0,0 +1,72 @@ +import {Command} from "../command.ts"; +import { + ActionRowBuilder, + ApplicationIntegrationType, ButtonBuilder, ButtonStyle, + ChatInputCommandInteraction, EmbedBuilder, + InteractionContextType, + SlashCommandBuilder +} from "discord.js"; +import { Config } from "../config.ts"; +import {getSongOnPreferredProvider, kyzaify} from "../helper.ts"; + +export default class PingCommand extends Command { + async run(interaction: ChatInputCommandInteraction, config: Config) { + await interaction.deferReply() + const search = interaction.options.getString("search")! + const paramsObj = {entity: "song", term: search}; + const searchParams = new URLSearchParams(paramsObj); + const itunesinfo = (await (await fetch(`https://itunes.apple.com/search?${searchParams.toString()}`)).json()).results[0]; + const link = itunesinfo.trackViewUrl + const songlink = await fetch(`https://api.song.link/v1-alpha.1/links?url=${link}`).then(a => a.json()) + const preferredApi = getSongOnPreferredProvider(songlink, link)! + + const embed = new EmbedBuilder() + .setAuthor({ + name: preferredApi.artist, + }) + .setTitle(preferredApi.title) + .setThumbnail(preferredApi.thumbnailUrl) + .setFooter({ + text: "amy jr", + }); + const meow = Object.keys(songlink.linksByPlatform) + let message = "" + + const nya: ActionRowBuilder[] = []; + let currentRow = new ActionRowBuilder(); + + for (const meowi of meow) { + if (currentRow.components.length >= 5) { + nya.push(currentRow); + currentRow = new ActionRowBuilder(); + } + currentRow.addComponents( + new ButtonBuilder() + .setURL(songlink.linksByPlatform[meowi].url) + .setLabel(kyzaify(meowi)) + .setStyle(ButtonStyle.Link) + ); + } + if (currentRow.components.length > 0) { + nya.push(currentRow); + } + + await interaction.followUp({ + components: nya, + embeds: [embed] + }); + } + + slashCommand = new SlashCommandBuilder() + .setName("musicsearch") + .setDescription("search yo music").setIntegrationTypes([ + ApplicationIntegrationType.UserInstall + ]).addStringOption(option =>{ + return option.setName("search").setDescription("shit you wanna search").setRequired(true); + }) + .setContexts([ + InteractionContextType.BotDM, + InteractionContextType.Guild, + InteractionContextType.PrivateChannel + ]); +} diff --git a/src/commands/uwuifier.ts b/src/commands/uwuifier.ts new file mode 100644 index 0000000..f5a06b7 --- /dev/null +++ b/src/commands/uwuifier.ts @@ -0,0 +1,89 @@ +import { + ApplicationCommandType, + ContextMenuCommandBuilder, + ContextMenuCommandInteraction, + InteractionContextType, + Message, + Snowflake, + User +} from "discord.js"; +import { ContextCommand } from "../command.ts"; + +export default class Uwuifier extends ContextCommand { + targetType: ApplicationCommandType.Message = ApplicationCommandType.Message; + contextDefinition: ContextMenuCommandBuilder = + new ContextMenuCommandBuilder() + .setName('uwuify') + .setType(ApplicationCommandType.Message) + async run(interaction: ContextMenuCommandInteraction, target: Message): Promise { + + const endings = [ + "rawr x3", + "OwO", + "UwU", + "o.O", + "-.-", + ">w<", + "(⑅˘꒳˘)", + "(ꈍᴗꈍ)", + "(˘ω˘)", + "(U ᵕ U❁)", + "σωσ", + "òωó", + "(///ˬ///✿)", + "(U ﹏ U)", + "( ͡o ω ͡o )", + "ʘwʘ", + ":3", + ":3", + "XD", + "nyaa~~", + "mya", + ">_<", + "😳", + "🥺", + "😳😳😳", + "rawr", + "^^", + "^^;;", + "(ˆ ﻌ ˆ)♡", + "^•ﻌ•^", + "/(^•ω•^)", + "(✿oωo)" + ]; + + const replacements = [ + ["small", "smol"], + ["cute", "kawaii~"], + ["fluff", "floof"], + ["love", "luv"], + ["stupid", "baka"], + ["what", "nani"], + ["meow", "nya~"], + ["hello", "hewwo"], + ]; + await interaction.deferReply(); + let message = target.content; + function getRandomElement(arr:T[]):T { + const randomIndex = Math.floor(Math.random() * arr.length); + return arr[randomIndex]; + } + + + function uwuify(message: string): string { + message = message.toLowerCase(); + for (const pair of replacements) { + message = message.replaceAll(pair[0], pair[1]); + } + message = message + .replaceAll(/([ \t\n])n/g, "$1ny") + .replaceAll(/[lr]/g, "w") + .replaceAll(/([ \t\n])([a-z])/g, (_, p1, p2) => Math.random() < .5 ? `${p1}${p2}-${p2}` : `${p1}${p2}`) + .replaceAll(/([^.,!][.,!])([ \t\n])/g, (_, p1, p2) => `${p1} ${getRandomElement(endings)}${p2}`); + return message; + } + + interaction.followUp(uwuify(message)); + + } +} \ No newline at end of file