From 6da17c1409abed2246d5b3bea68d28c8acf3ef3d Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Wed, 10 Sep 2025 05:14:27 -0400 Subject: [PATCH] Merge Freaky and Morse into MoreCMDS --- src/equicordplugins/freaky/README.md | 3 - src/equicordplugins/freaky/index.tsx | 60 --------------- .../moreCommands/commands/misc.ts | 37 +++++++++- src/equicordplugins/moreCommands/index.ts | 2 + src/equicordplugins/moreCommands/utils.ts | 53 ++++++++++++++ src/equicordplugins/morse/index.ts | 73 ------------------- .../index.tsx | 2 - src/equicordplugins/platformSpoofer/index.tsx | 16 ---- .../unitConverter/ConverterAccessory.tsx | 2 +- .../translate/TranslationAccessory.tsx | 2 +- 10 files changed, 93 insertions(+), 157 deletions(-) delete mode 100644 src/equicordplugins/freaky/README.md delete mode 100644 src/equicordplugins/freaky/index.tsx delete mode 100644 src/equicordplugins/morse/index.ts diff --git a/src/equicordplugins/freaky/README.md b/src/equicordplugins/freaky/README.md deleted file mode 100644 index 7ea56617d..000000000 --- a/src/equicordplugins/freaky/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Freaky - -Changes your text to look like this 𝓔𝓺𝓾𝓲𝓬𝓸𝓻𝓭 diff --git a/src/equicordplugins/freaky/index.tsx b/src/equicordplugins/freaky/index.tsx deleted file mode 100644 index fe9a08c3d..000000000 --- a/src/equicordplugins/freaky/index.tsx +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption } from "@api/Commands"; -import { definePluginSettings } from "@api/Settings"; -import { EquicordDevs } from "@utils/constants"; -import { sendMessage } from "@utils/discord"; -import definePlugin, { OptionType } from "@utils/types"; - -const charMap: Record = { - q: "𝓺", w: "𝔀", e: "𝓮", r: "𝓻", t: "𝓽", y: "𝔂", u: "𝓾", i: "𝓲", o: "𝓸", p: "𝓹", - a: "𝓪", s: "𝓼", d: "𝓭", f: "𝓯", g: "𝓰", h: "𝓱", j: "𝓳", k: "𝓴", l: "𝓵", z: "𝔃", - x: "𝔁", c: "𝓬", v: "𝓿", b: "𝓫", n: "𝓷", m: "𝓶", Q: "𝓠", W: "𝓦", E: "𝓔", R: "𝓡", - T: "𝓣", Y: "𝓨", U: "𝓤", I: "𝓘", O: "𝓞", P: "𝓟", A: "𝓐", S: "𝓢", D: "𝓓", F: "𝓕", - G: "𝓖", H: "𝓗", J: "𝓙", K: "𝓚", L: "𝓛", Z: "𝓩", X: "𝓧", C: "𝓒", V: "𝓥", B: "𝓑", - N: "𝓝", M: "𝓜", -}; - -const mapCharacters = (text: string, map: Record) => - text.split("").map(char => map[char] || char).join(""); - -function makeFreaky(text: string) { - text = mapCharacters(text.trim() || "freaky", charMap); - if (settings.store.addFreakyEnding) text += Math.random() < 0.25 ? " 👅" : " ❤️"; - return text; -} - -const settings = definePluginSettings({ - addFreakyEnding: { - type: OptionType.BOOLEAN, - description: "Add 👅 or ❤️ at the end", - default: true - } -}); - -export default definePlugin({ - name: "Freaky", - description: "freaky.", - authors: [EquicordDevs.nyx], - settings, - commands: [ - { - name: "freaky", - description: "it's freaky.", - inputType: ApplicationCommandInputType.BUILT_IN, - options: [{ - name: "message", - description: "yoooo freaky", - type: ApplicationCommandOptionType.STRING, - required: true - }], - execute: (opts, ctx) => { - sendMessage(ctx.channel.id, { content: makeFreaky(findOption(opts, "message", "")) }); - } - } - ] -}); diff --git a/src/equicordplugins/moreCommands/commands/misc.ts b/src/equicordplugins/moreCommands/commands/misc.ts index 1599524c3..3a29f3cea 100644 --- a/src/equicordplugins/moreCommands/commands/misc.ts +++ b/src/equicordplugins/moreCommands/commands/misc.ts @@ -7,7 +7,8 @@ import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, OptionalMessageOption, RequiredMessageOption, sendBotMessage } from "@api/Commands"; import { UserStore } from "@webpack/common"; -import { getCuteAnimeBoys, getCuteNeko, getCutePats, mock } from "../utils"; +import { fromMorse, getCuteAnimeBoys, getCuteNeko, getCutePats, isMorse, makeFreaky, mock, toMorse } from "../utils"; +import { sendMessage } from "@utils/discord"; export default [ { @@ -95,5 +96,39 @@ export default [ const victim = findOption(opts, "victim") as string; return { content: `<@${UserStore.getCurrentUser().id}> slaps ${victim} around a bit with a large trout` }; } + }, + { + name: "freaky", + description: "it's freaky.", + inputType: ApplicationCommandInputType.BUILT_IN, + options: [{ + name: "message", + description: "yoooo freaky", + type: ApplicationCommandOptionType.STRING, + required: true + }], + execute: (opts, ctx) => { + sendMessage(ctx.channel.id, { content: makeFreaky(findOption(opts, "message", "")) }); + } + }, + { + inputType: ApplicationCommandInputType.BUILT_IN_TEXT, + name: "morse", + description: "Translate to or from Morse code", + options: [ + { + name: "text", + description: "Text to convert", + type: ApplicationCommandOptionType.STRING, + required: true + } + ], + execute: opts => { + const input = opts.find(o => o.name === "text")?.value as string; + const output = isMorse(input) ? fromMorse(input) : toMorse(input); + return { + content: `${output}` + }; + }, } ]; diff --git a/src/equicordplugins/moreCommands/index.ts b/src/equicordplugins/moreCommands/index.ts index 7423f6f81..c3cb2baf7 100644 --- a/src/equicordplugins/moreCommands/index.ts +++ b/src/equicordplugins/moreCommands/index.ts @@ -25,12 +25,14 @@ import misc from "./commands/misc"; import system from "./commands/system"; import text from "./commands/text"; import time from "./commands/time"; +import { settings } from "./utils"; migratePluginSettings("MoreCommands", "CuteAnimeBoys", "CuteNekos", "CutePats", "Slap"); export default definePlugin({ name: "MoreCommands", description: "Adds various fun and useful commands", authors: [Devs.Arjix, Devs.amy, Devs.Samu, EquicordDevs.zyqunix, EquicordDevs.ShadyGoat, Devs.thororen, Devs.Korbo], + settings, commands: [ ...choice, ...system, diff --git a/src/equicordplugins/moreCommands/utils.ts b/src/equicordplugins/moreCommands/utils.ts index d4aa96626..f539d9636 100644 --- a/src/equicordplugins/moreCommands/utils.ts +++ b/src/equicordplugins/moreCommands/utils.ts @@ -4,6 +4,18 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ +import { definePluginSettings } from "@api/Settings"; +import { OptionType } from "@utils/types"; + +export const settings = definePluginSettings({ + addFreakyEnding: { + type: OptionType.BOOLEAN, + description: "Add 👅 or ❤️ at the end", + default: true + } +}); + + export function rand(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } @@ -34,3 +46,44 @@ export function mock(input: string): string { } return output; } + +const charMap: Record = { + q: "𝓺", w: "𝔀", e: "𝓮", r: "𝓻", t: "𝓽", y: "𝔂", u: "𝓾", i: "𝓲", o: "𝓸", p: "𝓹", + a: "𝓪", s: "𝓼", d: "𝓭", f: "𝓯", g: "𝓰", h: "𝓱", j: "𝓳", k: "𝓴", l: "𝓵", z: "𝔃", + x: "𝔁", c: "𝓬", v: "𝓿", b: "𝓫", n: "𝓷", m: "𝓶", Q: "𝓠", W: "𝓦", E: "𝓔", R: "𝓡", + T: "𝓣", Y: "𝓨", U: "𝓤", I: "𝓘", O: "𝓞", P: "𝓟", A: "𝓐", S: "𝓢", D: "𝓓", F: "𝓕", + G: "𝓖", H: "𝓗", J: "𝓙", K: "𝓚", L: "𝓛", Z: "𝓩", X: "𝓧", C: "𝓒", V: "𝓥", B: "𝓑", + N: "𝓝", M: "𝓜", +}; + +const mapCharacters = (text: string, map: Record) => + text.split("").map(char => map[char] || char).join(""); + +export function makeFreaky(text: string) { + text = mapCharacters(text.trim() || "freaky", charMap); + if (settings.store.addFreakyEnding) text += Math.random() < 0.25 ? " 👅" : " ❤️"; + return text; +} + +const morseMap = { + A: ".-", B: "-...", C: "-.-.", D: "-..", E: ".", F: "..-.", + G: "--.", H: "....", I: "..", J: ".---", K: "-.-", L: ".-..", + M: "--", N: "-.", O: "---", P: ".--.", Q: "--.-", R: ".-.", + S: "...", T: "-", U: "..-", V: "...-", W: ".--", X: "-..-", + Y: "-.--", Z: "--..", + 0: "-----", 1: ".----", 2: "..---", 3: "...--", 4: "....-", + 5: ".....", 6: "-....", 7: "--...", 8: "---..", 9: "----.", + " ": "/" +}; + +export const toMorse = (text: string) => { + return text.toUpperCase().split("").map(char => morseMap[char] ?? "").join(" "); +}; + +export const fromMorse = (text: string) => { + const reversedMap = Object.fromEntries(Object.entries(morseMap).map(([k, v]) => [v, k])); + const raw = text.split(" ").map(code => reversedMap[code] ?? "").join("").toLowerCase(); + return raw.charAt(0).toUpperCase() + raw.slice(1); +}; + +export const isMorse = (text: string) => /^[.\-/ ]+$/.test(text); diff --git a/src/equicordplugins/morse/index.ts b/src/equicordplugins/morse/index.ts deleted file mode 100644 index 1bb7d75ea..000000000 --- a/src/equicordplugins/morse/index.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2022 Vendicated and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . -*/ - -import { ApplicationCommandInputType, ApplicationCommandOptionType } from "@api/Commands"; -import { EquicordDevs } from "@utils/constants"; -import definePlugin from "@utils/types"; - -const morseMap = { - A: ".-", B: "-...", C: "-.-.", D: "-..", E: ".", F: "..-.", - G: "--.", H: "....", I: "..", J: ".---", K: "-.-", L: ".-..", - M: "--", N: "-.", O: "---", P: ".--.", Q: "--.-", R: ".-.", - S: "...", T: "-", U: "..-", V: "...-", W: ".--", X: "-..-", - Y: "-.--", Z: "--..", - 0: "-----", 1: ".----", 2: "..---", 3: "...--", 4: "....-", - 5: ".....", 6: "-....", 7: "--...", 8: "---..", 9: "----.", - " ": "/" -}; - -const toMorse = (text: string) => { - return text.toUpperCase().split("").map(char => morseMap[char] ?? "").join(" "); -}; - -const fromMorse = (text: string) => { - const reversedMap = Object.fromEntries(Object.entries(morseMap).map(([k, v]) => [v, k])); - const raw = text.split(" ").map(code => reversedMap[code] ?? "").join("").toLowerCase(); - return raw.charAt(0).toUpperCase() + raw.slice(1); -}; - -// boo regex -const isMorse = (text: string) => /^[.\-/ ]+$/.test(text); - -export default definePlugin({ - name: "Morse", - description: "A slash command to translate to/from morse code.", - authors: [EquicordDevs.zyqunix], - commands: [ - { - inputType: ApplicationCommandInputType.BUILT_IN_TEXT, - name: "morse", - description: "Translate to or from Morse code", - options: [ - { - name: "text", - description: "Text to convert", - type: ApplicationCommandOptionType.STRING, - required: true - } - ], - execute: opts => { - const input = opts.find(o => o.name === "text")?.value as string; - const output = isMorse(input) ? fromMorse(input) : toMorse(input); - return { - content: `${output}` - }; - }, - } - ] -}); diff --git a/src/equicordplugins/notificationTitle.discordDesktop/index.tsx b/src/equicordplugins/notificationTitle.discordDesktop/index.tsx index f0fe33231..ff51088ce 100644 --- a/src/equicordplugins/notificationTitle.discordDesktop/index.tsx +++ b/src/equicordplugins/notificationTitle.discordDesktop/index.tsx @@ -59,8 +59,6 @@ export default definePlugin({ } result.title = title; - console.log({ ...result, channel, message, user }); - return result; } }); diff --git a/src/equicordplugins/platformSpoofer/index.tsx b/src/equicordplugins/platformSpoofer/index.tsx index 2999dff80..f81f3b6a2 100644 --- a/src/equicordplugins/platformSpoofer/index.tsx +++ b/src/equicordplugins/platformSpoofer/index.tsx @@ -22,18 +22,6 @@ const settings = definePluginSettings({ value: "desktop", default: true, }, - { - label: "Web", - value: "web", - }, - { - label: "Android", - value: "android" - }, - { - label: "iOS", - value: "ios" - }, { label: "Xbox", value: "xbox", @@ -81,10 +69,6 @@ export default definePlugin({ return { browser: "Discord Client", vcIcon: 0 }; case "web": return { browser: "Discord Web", vcIcon: 0 }; - case "ios": - return { browser: "Discord iOS", vcIcon: 1 }; - case "android": - return { browser: "Discord Android", vcIcon: 1 }; case "xbox": return { browser: "Discord Embedded", vcIcon: 2 }; case "playstation": diff --git a/src/equicordplugins/unitConverter/ConverterAccessory.tsx b/src/equicordplugins/unitConverter/ConverterAccessory.tsx index ec897f37e..60d2980de 100644 --- a/src/equicordplugins/unitConverter/ConverterAccessory.tsx +++ b/src/equicordplugins/unitConverter/ConverterAccessory.tsx @@ -20,7 +20,7 @@ import { classNameFactory } from "@api/Styles"; import { Message } from "@vencord/discord-types"; import { useState } from "@webpack/common"; -export const conversions = new Map void>(); +export const conversions = new Map void>(); const cl = classNameFactory("vc-converter-"); function Dismiss({ onDismiss }: { onDismiss: () => void; }) { return ( diff --git a/src/plugins/translate/TranslationAccessory.tsx b/src/plugins/translate/TranslationAccessory.tsx index 00e35689a..a21408662 100644 --- a/src/plugins/translate/TranslationAccessory.tsx +++ b/src/plugins/translate/TranslationAccessory.tsx @@ -22,7 +22,7 @@ import { Parser, useEffect, useState } from "@webpack/common"; import { TranslateIcon } from "./TranslateIcon"; import { cl, TranslationValue } from "./utils"; -const TranslationSetters = new Map void>(); +const TranslationSetters = new Map void>(); export function handleTranslate(messageId: string, data: TranslationValue) { TranslationSetters.get(messageId)!(data);