Equicord/src/equicordplugins/noBulletPoints/index.tsx

30 lines
928 B
TypeScript
Raw Normal View History

2024-07-18 17:48:50 -04:00
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
2025-01-22 21:22:25 -05:00
import { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
2024-07-18 17:48:50 -04:00
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
export default definePlugin({
name: "NoBulletPoints",
description: "Stops you from typing markdown bullet points (stinky)",
authors: [Devs.Samwich],
dependencies: ["MessageEventsAPI"],
start() {
2025-01-22 21:22:25 -05:00
this.preSend = addMessagePreSendListener((channelId, msg) => {
2024-07-18 17:48:50 -04:00
msg.content = textProcessing(msg.content);
});
},
stop() {
2025-01-22 21:22:25 -05:00
this.preSend = removeMessagePreSendListener((channelId, msg) => {
2024-07-18 17:48:50 -04:00
msg.content = textProcessing(msg.content);
});
},
});
function textProcessing(text: string): string {
return text.replace(/- /g, "\\- ");
}