Merge Freaky and Morse into MoreCMDS

This commit is contained in:
thororen1234 2025-09-10 05:14:27 -04:00
parent 612522cdc1
commit 6da17c1409
No known key found for this signature in database
10 changed files with 93 additions and 157 deletions

View file

@ -1,3 +0,0 @@
# Freaky
Changes your text to look like this 𝓔𝓺𝓾𝓲𝓬𝓸𝓻𝓭

View file

@ -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<string, string> = {
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<string, string>) =>
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", "")) });
}
}
]
});

View file

@ -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}`
};
},
}
];

View file

@ -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,

View file

@ -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<string, string> = {
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<string, string>) =>
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);

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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}`
};
},
}
]
});

View file

@ -59,8 +59,6 @@ export default definePlugin({
}
result.title = title;
console.log({ ...result, channel, message, user });
return result;
}
});

View file

@ -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":

View file

@ -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<string, (conv: string) => void>();
export const conversions = new Map<string,(conv: string) => void>();
const cl = classNameFactory("vc-converter-");
function Dismiss({ onDismiss }: { onDismiss: () => void; }) {
return (

View file

@ -22,7 +22,7 @@ import { Parser, useEffect, useState } from "@webpack/common";
import { TranslateIcon } from "./TranslateIcon";
import { cl, TranslationValue } from "./utils";
const TranslationSetters = new Map<string, (v: TranslationValue) => void>();
const TranslationSetters = new Map<string,(v: TranslationValue) => void>();
export function handleTranslate(messageId: string, data: TranslationValue) {
TranslationSetters.get(messageId)!(data);