2025-05-29 09:50:07 -04:00
|
|
|
/*
|
|
|
|
|
* Vencord, a modification for Discord's desktop app
|
|
|
|
|
* Copyright (c) 2022 Vendicated, Samu 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/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2025-09-10 06:04:17 -04:00
|
|
|
import { addMessagePreEditListener, addMessagePreSendListener, MessageObject, removeMessagePreEditListener, removeMessagePreSendListener } from "@api/MessageEvents";
|
2025-09-01 16:16:46 -04:00
|
|
|
import { migratePluginSettings } from "@api/Settings";
|
2025-06-20 00:19:55 +02:00
|
|
|
import { Devs, EquicordDevs } from "@utils/constants";
|
2025-05-29 09:50:07 -04:00
|
|
|
import definePlugin from "@utils/types";
|
|
|
|
|
|
2025-09-01 16:16:46 -04:00
|
|
|
import choice from "./commands/choice";
|
|
|
|
|
import misc from "./commands/misc";
|
|
|
|
|
import system from "./commands/system";
|
|
|
|
|
import text from "./commands/text";
|
|
|
|
|
import time from "./commands/time";
|
2025-09-10 06:04:17 -04:00
|
|
|
import { settings, uwuify, uwuifyArray } from "./utils";
|
2025-05-29 09:50:07 -04:00
|
|
|
|
2025-09-01 16:16:46 -04:00
|
|
|
migratePluginSettings("MoreCommands", "CuteAnimeBoys", "CuteNekos", "CutePats", "Slap");
|
2025-05-29 09:50:07 -04:00
|
|
|
export default definePlugin({
|
|
|
|
|
name: "MoreCommands",
|
2025-09-01 16:16:46 -04:00
|
|
|
description: "Adds various fun and useful commands",
|
2025-09-10 06:04:17 -04:00
|
|
|
authors: [Devs.Arjix, Devs.amy, Devs.Samu, EquicordDevs.zyqunix, EquicordDevs.ShadyGoat, Devs.thororen, Devs.Korbo, Devs.nyx, Devs.amy],
|
2025-09-10 05:14:27 -04:00
|
|
|
settings,
|
2025-05-29 09:50:07 -04:00
|
|
|
commands: [
|
2025-09-01 16:16:46 -04:00
|
|
|
...choice,
|
|
|
|
|
...system,
|
|
|
|
|
...text,
|
|
|
|
|
...time,
|
|
|
|
|
...misc,
|
2025-09-10 06:04:17 -04:00
|
|
|
],
|
|
|
|
|
patches: [
|
|
|
|
|
{
|
|
|
|
|
find: ".isPureReactComponent=!0;",
|
2025-09-10 06:10:18 -04:00
|
|
|
predicate: () => settings.store.uwuEverything,
|
2025-09-10 06:04:17 -04:00
|
|
|
replacement: {
|
|
|
|
|
match: /(?<=.defaultProps\)void 0.{0,60})(\i)\)/,
|
|
|
|
|
replace: "$self.uwuifyProps($1))"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
uwuifyProps(props: any) {
|
|
|
|
|
if (!props.children) return props;
|
|
|
|
|
if (typeof props.children === "string") props.children = uwuify(props.children);
|
|
|
|
|
else if (Array.isArray(props.children)) props.children = uwuifyArray(props.children);
|
|
|
|
|
return props;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onSend(msg: MessageObject) {
|
|
|
|
|
// Only run when it's enabled
|
2025-09-10 06:10:18 -04:00
|
|
|
if (settings.store.uwuEveryMessage) {
|
2025-09-10 06:04:17 -04:00
|
|
|
msg.content = uwuify(msg.content);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
start() {
|
|
|
|
|
this.preSend = addMessagePreSendListener((_, msg) => this.onSend(msg));
|
|
|
|
|
this.preEdit = addMessagePreEditListener((_cid, _mid, msg) =>
|
|
|
|
|
this.onSend(msg)
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
|
removeMessagePreSendListener(this.preSend);
|
|
|
|
|
removeMessagePreEditListener(this.preEdit);
|
|
|
|
|
},
|
2025-05-29 09:50:07 -04:00
|
|
|
});
|