Equicord/src/equicordplugins/noBulletPoints/index.tsx
Jake ace02b3dd7
fix/NoBulletPoints (#430)
* add serialization for settings and a myraid of other fixes rewrites.

* test dummy settings

* fix issue with commits not being logged, rewrite some elements

* remove dummy setting

* fix * not working

---------

Co-authored-by: Jake <jake@Georges-MacBook-Air.local>
2025-10-02 08:39:08 -04:00

29 lines
934 B
TypeScript

/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
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() {
this.preSend = addMessagePreSendListener((channelId, msg) => {
msg.content = textProcessing(msg.content);
});
},
stop() {
this.preSend = removeMessagePreSendListener((channelId, msg) => {
msg.content = textProcessing(msg.content);
});
},
});
function textProcessing(text: string): string {
return text.replace(/([*-]) /g, "\\$1 ");
}