This commit is contained in:
thororen1234 2025-01-22 21:22:25 -05:00
parent acf04bb01d
commit 90d946e7c6
26 changed files with 84 additions and 84 deletions

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents"; import { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
import { migratePluginSettings } from "@api/Settings"; import { migratePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
@ -34,13 +34,13 @@ export default definePlugin({
} }
], ],
start() { start() {
this.preSend = addPreSendListener((_, msg) => { this.preSend = addMessagePreSendListener((_, msg) => {
msg.content = msg.content.replace(/@someone/g, () => `<@${randomUser()}>`); msg.content = msg.content.replace(/@someone/g, () => `<@${randomUser()}>`);
}); });
}, },
stop() { stop() {
removePreSendListener(this.preSend); removeMessagePreSendListener(this.preSend);
} }
}); });

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { addButton, removeButton } from "@api/MessagePopover"; import { addMessagePopoverButton, removeMessagePopoverButton } from "@api/MessagePopover";
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { CodeBlock } from "@components/CodeBlock"; import { CodeBlock } from "@components/CodeBlock";
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
@ -116,7 +116,7 @@ export default definePlugin({
}, },
start() { start() {
addButton("DecodeBase64", msg => { addMessagePopoverButton("DecodeBase64", msg => {
const handleClick = () => { const handleClick = () => {
const base64Strings = findBase64Strings(msg.content); const base64Strings = findBase64Strings(msg.content);
const decodedContent = decodeBase64Strings(base64Strings); const decodedContent = decodeBase64Strings(base64Strings);
@ -157,6 +157,6 @@ export default definePlugin({
}, },
stop() { stop() {
removeButton("DecodeBase64"); removeMessagePopoverButton("DecodeBase64");
} }
}); });

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { addPreSendListener } from "@api/MessageEvents"; import { addMessagePreSendListener } from "@api/MessageEvents";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { Alerts, ChannelStore, Forms } from "@webpack/common"; import { Alerts, ChannelStore, Forms } from "@webpack/common";
@ -41,7 +41,7 @@ export default definePlugin({
authors: [Devs.Samwich], authors: [Devs.Samwich],
dependencies: ["MessageEventsAPI"], dependencies: ["MessageEventsAPI"],
start() { start() {
this.preSend = addPreSendListener(async (channelId, messageObj, extra) => { this.preSend = addMessagePreSendListener(async (channelId, messageObj, extra) => {
if (ChannelStore.getChannel(channelId.toString()).isDM()) return { cancel: false }; if (ChannelStore.getChannel(channelId.toString()).isDM()) return { cancel: false };

View file

@ -11,7 +11,7 @@ import {
sendBotMessage, sendBotMessage,
} from "@api/Commands"; } from "@api/Commands";
import * as DataStore from "@api/DataStore"; import * as DataStore from "@api/DataStore";
import { addPreSendListener, removePreSendListener, SendListener } from "@api/MessageEvents"; import { addMessagePreSendListener, removeMessagePreSendListener, SendListener } from "@api/MessageEvents";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { sleep } from "@utils/misc"; import { sleep } from "@utils/misc";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
@ -72,8 +72,8 @@ const ChatBarIcon: ChatBarButton = ({ isMainChat }) => {
} }
}; };
addPreSendListener(listener); addMessagePreSendListener(listener);
return () => void removePreSendListener(listener); return () => void removeMessagePreSendListener(listener);
}, [enabled]); }, [enabled]);
if (!isMainChat) return null; if (!isMainChat) return null;

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { addButton, removeButton } from "@api/MessagePopover"; import { addMessagePopoverButton, removeMessagePopoverButton } from "@api/MessagePopover";
import { disableStyle, enableStyle } from "@api/Styles"; import { disableStyle, enableStyle } from "@api/Styles";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
@ -72,7 +72,7 @@ export default definePlugin({
authors: [Devs.newwares], authors: [Devs.newwares],
start() { start() {
enableStyle(styles); enableStyle(styles);
addButton("vc-findreply", message => { addMessagePopoverButton("vc-findreply", message => {
if (!message.id) return null; if (!message.id) return null;
const replies = findReplies(message); const replies = findReplies(message);
if (Vencord.Settings.plugins.FindReply.hideButtonIfNoReply && !replies.length) return null; if (Vencord.Settings.plugins.FindReply.hideButtonIfNoReply && !replies.length) return null;
@ -117,7 +117,7 @@ export default definePlugin({
}); });
}, },
stop() { stop() {
removeButton("vc-findreply"); removeMessagePopoverButton("vc-findreply");
root && root.unmount(); root && root.unmount();
element?.remove(); element?.remove();
disableStyle(styles); disableStyle(styles);

View file

@ -148,10 +148,10 @@ export default definePlugin({
description: "Adds badges showcasing how long you have been friends with a user for", description: "Adds badges showcasing how long you have been friends with a user for",
authors: [Devs.Samwich], authors: [Devs.Samwich],
start() { start() {
getBadgesToApply().forEach(thing => Vencord.Api.Badges.addBadge(thing)); getBadgesToApply().forEach(thing => Vencord.Api.Badges.addProfileBadge(thing));
}, },
stop() { stop() {
getBadgesToApply().forEach(thing => Vencord.Api.Badges.removeBadge(thing)); getBadgesToApply().forEach(thing => Vencord.Api.Badges.removeProfileBadge(thing));
}, },
}); });

View file

@ -7,7 +7,7 @@
import { addChatBarButton, ChatBarButton, removeChatBarButton } from "@api/ChatButtons"; import { addChatBarButton, ChatBarButton, removeChatBarButton } from "@api/ChatButtons";
import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands"; import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands";
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu"; import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
import { addPreSendListener, removePreSendListener, SendListener } from "@api/MessageEvents"; import { addMessagePreSendListener, removeMessagePreSendListener, SendListener } from "@api/MessageEvents";
import { definePluginSettings, Settings } from "@api/Settings"; import { definePluginSettings, Settings } from "@api/Settings";
import { ErrorCard } from "@components/ErrorCard"; import { ErrorCard } from "@components/ErrorCard";
import { Link } from "@components/Link"; import { Link } from "@components/Link";
@ -96,9 +96,9 @@ const furudosettings = definePluginSettings(
function messageSendListenerFuncs() { function messageSendListenerFuncs() {
if (furudosettings.store.isEnabled) { if (furudosettings.store.isEnabled) {
addPreSendListener(presendObject); addMessagePreSendListener(presendObject);
} else { } else {
removePreSendListener(presendObject); removeMessagePreSendListener(presendObject);
} }
} }
@ -243,6 +243,6 @@ export default definePlugin({
stop: () => { stop: () => {
removeChatBarButton("FurudoSpeak"); removeChatBarButton("FurudoSpeak");
removePreSendListener(presendObject); removeMessagePreSendListener(presendObject);
} }
}); });

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { addBadge, BadgePosition, ProfileBadge, removeBadge } from "@api/Badges"; import { addProfileBadge, BadgePosition, ProfileBadge, removeProfileBadge } from "@api/Badges";
import { classNameFactory } from "@api/Styles"; import { classNameFactory } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { Devs, EquicordDevs } from "@utils/constants"; import { Devs, EquicordDevs } from "@utils/constants";
@ -137,8 +137,8 @@ export default definePlugin({
description: "Adds global badges from other client mods", description: "Adds global badges from other client mods",
authors: [Devs.HypedDomi, EquicordDevs.Wolfie], authors: [Devs.HypedDomi, EquicordDevs.Wolfie],
start: () => addBadge(Badge), start: () => addProfileBadge(Badge),
stop: () => removeBadge(Badge), stop: () => removeProfileBadge(Badge),
options: { options: {
showPrefix: { showPrefix: {

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents"; import { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
@ -77,13 +77,13 @@ export default definePlugin({
} }
}), }),
async start() { async start() {
this.preSend = addPreSendListener((_channelId, msg) => { this.preSend = addMessagePreSendListener((_channelId, msg) => {
const newContent = this.replaceBadVerbs(this.replaceBadNouns(msg.content)); const newContent = this.replaceBadVerbs(this.replaceBadNouns(msg.content));
msg.content = newContent; msg.content = newContent;
}); });
}, },
stop() { stop() {
removePreSendListener(this.preSend); removeMessagePreSendListener(this.preSend);
}, },
getEnabledBadNouns() { getEnabledBadNouns() {
const thingToReturn: string[] = []; const thingToReturn: string[] = [];

View file

@ -8,7 +8,7 @@ import "./styles.css";
import { NavContextMenuPatchCallback } from "@api/ContextMenu"; import { NavContextMenuPatchCallback } from "@api/ContextMenu";
import { get, set } from "@api/DataStore"; import { get, set } from "@api/DataStore";
import { addAccessory, removeAccessory } from "@api/MessageAccessories"; import { addMessageAccessory, removeMessageAccessory } from "@api/MessageAccessories";
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { classNameFactory } from "@api/Styles"; import { classNameFactory } from "@api/Styles";
import { EquicordDevs } from "@utils/constants"; import { EquicordDevs } from "@utils/constants";
@ -147,7 +147,7 @@ export default definePlugin({
buildCss(); buildCss();
} }
addAccessory("vc-hide-message", ({ message }) => { addMessageAccessory("vc-hide-message", ({ message }) => {
if (hiddenMessages.has(message.id) && settings.store.showNotice) return <HideMessageAccessory id={message.id} />; if (hiddenMessages.has(message.id) && settings.store.showNotice) return <HideMessageAccessory id={message.id} />;
return null; return null;
}); });
@ -156,7 +156,7 @@ export default definePlugin({
async stop() { async stop() {
for (const id of hiddenMessages.keys()) revealMessage(id); for (const id of hiddenMessages.keys()) revealMessage(id);
removeAccessory("vc-hide-message"); removeMessageAccessory("vc-hide-message");
style.remove(); style.remove();
hiddenMessages.clear(); hiddenMessages.clear();

View file

@ -20,7 +20,7 @@ import "./style.css";
import { NavContextMenuPatchCallback } from "@api/ContextMenu"; import { NavContextMenuPatchCallback } from "@api/ContextMenu";
import { DataStore } from "@api/index"; import { DataStore } from "@api/index";
import { addButton, removeButton } from "@api/MessagePopover"; import { addMessagePopoverButton, removeMessagePopoverButton } from "@api/MessagePopover";
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { EquicordDevs } from "@utils/constants"; import { EquicordDevs } from "@utils/constants";
import { classes } from "@utils/misc"; import { classes } from "@utils/misc";
@ -114,7 +114,7 @@ export default definePlugin({
if (await DataStore.keys(HolyNoteStore).then(keys => !keys.includes("Main"))) return noteHandler.newNoteBook("Main"); if (await DataStore.keys(HolyNoteStore).then(keys => !keys.includes("Main"))) return noteHandler.newNoteBook("Main");
if (!noteHandlerCache.has("Main")) await DataStoreToCache(); if (!noteHandlerCache.has("Main")) await DataStoreToCache();
addButton("HolyNotes", message => { addMessagePopoverButton("HolyNotes", message => {
return { return {
label: "Save Note", label: "Save Note",
icon: NoteButtonPopover, icon: NoteButtonPopover,
@ -127,6 +127,6 @@ export default definePlugin({
}, },
async stop() { async stop() {
removeButton("HolyNotes"); removeMessagePopoverButton("HolyNotes");
} }
}); });

View file

@ -18,7 +18,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { addButton, removeButton } from "@api/MessagePopover"; import { addMessagePopoverButton, removeMessagePopoverButton } from "@api/MessagePopover";
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { classes } from "@utils/misc"; import { classes } from "@utils/misc";
@ -103,7 +103,7 @@ export default definePlugin({
return id !== "" ? id : this.settings.store.emojiID; return id !== "" ? id : this.settings.store.emojiID;
}, },
async start() { async start() {
addButton("Husk", msg => { addMessagePopoverButton("Husk", msg => {
return { return {
label: "Husk", label: "Husk",
icon: Husk, icon: Husk,
@ -121,7 +121,7 @@ export default definePlugin({
}, },
stop() { stop() {
removeButton("Husk"); removeMessagePopoverButton("Husk");
}, },
}); });

View file

@ -7,7 +7,7 @@
import "styles.css?managed"; import "styles.css?managed";
import { DataStore } from "@api/index"; import { DataStore } from "@api/index";
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents"; import { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
import { Heart } from "@components/Heart"; import { Heart } from "@components/Heart";
import { EquicordDevs } from "@utils/constants"; import { EquicordDevs } from "@utils/constants";
import { openUserProfile } from "@utils/discord"; import { openUserProfile } from "@utils/discord";
@ -364,7 +364,7 @@ export default definePlugin({
await data.initializeUsersCollection(); await data.initializeUsersCollection();
data.writeGuildsOwnersToCollection(); data.writeGuildsOwnersToCollection();
data.writeMembersFromUserGuildsToCollection(); data.writeMembersFromUserGuildsToCollection();
data._onMessagePreSend_preSend = addPreSendListener( data._onMessagePreSend_preSend = addMessagePreSendListener(
data.onMessagePreSend.bind(data) data.onMessagePreSend.bind(data)
); );
data.storageAutoSaveProtocol(); data.storageAutoSaveProtocol();
@ -385,7 +385,7 @@ export default definePlugin({
stop() { stop() {
const dataManager = this.dataManager as Data; const dataManager = this.dataManager as Data;
removePreSendListener(dataManager._onMessagePreSend_preSend); removeMessagePreSendListener(dataManager._onMessagePreSend_preSend);
clearInterval(dataManager._storageAutoSaveProtocol_interval); clearInterval(dataManager._storageAutoSaveProtocol_interval);
}, },
}); });

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents"; import { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
@ -13,12 +13,12 @@ export default definePlugin({
authors: [Devs.Samwich], authors: [Devs.Samwich],
dependencies: ["MessageEventsAPI"], dependencies: ["MessageEventsAPI"],
start() { start() {
this.preSend = addPreSendListener((channelId, msg) => { this.preSend = addMessagePreSendListener((channelId, msg) => {
msg.content = textProcessing(msg.content); msg.content = textProcessing(msg.content);
}); });
}, },
stop() { stop() {
this.preSend = removePreSendListener((channelId, msg) => { this.preSend = removeMessagePreSendListener((channelId, msg) => {
msg.content = textProcessing(msg.content); msg.content = textProcessing(msg.content);
}); });
}, },

View file

@ -5,8 +5,8 @@
*/ */
import { import {
addPreSendListener, addMessagePreSendListener,
removePreSendListener, removeMessagePreSendListener,
SendListener, SendListener,
} from "@api/MessageEvents"; } from "@api/MessageEvents";
import { import {
@ -38,10 +38,10 @@ export default definePlugin({
authors: [Devs.Samwich], authors: [Devs.Samwich],
dependencies: ["MessageEventsAPI"], dependencies: ["MessageEventsAPI"],
start() { start() {
addPreSendListener(presendObject); addMessagePreSendListener(presendObject);
}, },
stop() { stop() {
removePreSendListener(presendObject); removeMessagePreSendListener(presendObject);
}, },
settings, settings,
}); });

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents"; import { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
@ -36,12 +36,12 @@ export default definePlugin({
settings, settings,
start() { start() {
this.preSend = addPreSendListener((_, msg) => { this.preSend = addMessagePreSendListener((_, msg) => {
msg.content = replaceQuestionMarks(msg.content); msg.content = replaceQuestionMarks(msg.content);
}); });
}, },
stop() { stop() {
removePreSendListener(this.preSend); removeMessagePreSendListener(this.preSend);
} }
}); });

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { addPreSendListener, MessageExtra, MessageObject, removePreSendListener } from "@api/MessageEvents"; import { addMessagePreSendListener, MessageExtra, MessageObject, removeMessagePreSendListener } from "@api/MessageEvents";
import { EquicordDevs } from "@utils/constants"; import { EquicordDevs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
@ -14,6 +14,6 @@ export default definePlugin({
name: "RemixMe", name: "RemixMe",
description: "Turns every single message with attachment to have remix tag", description: "Turns every single message with attachment to have remix tag",
authors: [EquicordDevs.kvba], authors: [EquicordDevs.kvba],
start: () => addPreSendListener(handleMessage), start: () => addMessagePreSendListener(handleMessage),
stop: () => removePreSendListener(handleMessage) stop: () => removeMessagePreSendListener(handleMessage)
}); });

View file

@ -17,7 +17,7 @@
*/ */
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu"; import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
import { addButton, removeButton } from "@api/MessagePopover"; import { addMessagePopoverButton, removeMessagePopoverButton } from "@api/MessagePopover";
import { classNameFactory } from "@api/Styles"; import { classNameFactory } from "@api/Styles";
import { EquicordDevs } from "@utils/constants"; import { EquicordDevs } from "@utils/constants";
import { sendMessage } from "@utils/discord"; import { sendMessage } from "@utils/discord";
@ -103,7 +103,7 @@ export default definePlugin({
"message": messageCtxPatch "message": messageCtxPatch
}, },
start() { start() {
addButton("vc-repeat", message => { addMessagePopoverButton("vc-repeat", message => {
if (!message.content && message.stickerItems.length === 0) return null; if (!message.content && message.stickerItems.length === 0) return null;
return { return {
@ -119,7 +119,7 @@ export default definePlugin({
document.addEventListener("keydown", keydownListener); document.addEventListener("keydown", keydownListener);
}, },
stop() { stop() {
removeButton("vc-repeat"); removeMessagePopoverButton("vc-repeat");
document.removeEventListener("keyup", keyupListener); document.removeEventListener("keyup", keyupListener);
document.removeEventListener("keydown", keydownListener); document.removeEventListener("keydown", keydownListener);

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { addPreSendListener, removePreSendListener, SendListener } from "@api/MessageEvents"; import { addMessagePreSendListener, removeMessagePreSendListener, SendListener } from "@api/MessageEvents";
import { definePluginSettings, Settings } from "@api/Settings"; import { definePluginSettings, Settings } from "@api/Settings";
import { EquicordDevs } from "@utils/constants"; import { EquicordDevs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
@ -32,9 +32,9 @@ export default definePlugin({
} }
}), }),
start() { start() {
addPreSendListener(presendObject); addMessagePreSendListener(presendObject);
}, },
stop() { stop() {
removePreSendListener(presendObject); removeMessagePreSendListener(presendObject);
} }
}); });

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { addDecoration, removeDecoration } from "@api/MessageDecorations"; import { addMessageDecoration, removeMessageDecoration } from "@api/MessageDecorations";
import { Devs, EquicordDevs } from "@utils/constants"; import { Devs, EquicordDevs } from "@utils/constants";
import { isEquicordPluginDev, isPluginDev } from "@utils/misc"; import { isEquicordPluginDev, isPluginDev } from "@utils/misc";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
@ -145,9 +145,9 @@ export default definePlugin({
dependencies: ["MessageDecorationsAPI"], dependencies: ["MessageDecorationsAPI"],
settings, settings,
start: () => { start: () => {
addDecoration("vc-show-badges-in-chat", props => props.message?.author ? <ChatBadges author={props.message.author} /> : null); addMessageDecoration("vc-show-badges-in-chat", props => props.message?.author ? <ChatBadges author={props.message.author} /> : null);
}, },
stop: () => { stop: () => {
removeDecoration("vc-show-badges-in-chat"); removeMessageDecoration("vc-show-badges-in-chat");
} }
}); });

View file

@ -7,7 +7,7 @@
import { addChatBarButton, ChatBarButton, removeChatBarButton } from "@api/ChatButtons"; import { addChatBarButton, ChatBarButton, removeChatBarButton } from "@api/ChatButtons";
import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands"; import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands";
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu"; import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents"; import { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
import { definePluginSettings, migratePluginSettings } from "@api/Settings"; import { definePluginSettings, migratePluginSettings } from "@api/Settings";
import { EquicordDevs } from "@utils/constants"; import { EquicordDevs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
@ -104,12 +104,12 @@ export default definePlugin({
start: () => { start: () => {
if (settings.store.isEnabled) true; if (settings.store.isEnabled) true;
addChatBarButton("Signature", SignatureToggle); addChatBarButton("Signature", SignatureToggle);
addPreSendListener(handleMessage); addMessagePreSendListener(handleMessage);
}, },
stop: () => { stop: () => {
if (settings.store.isEnabled) false; if (settings.store.isEnabled) false;
removeChatBarButton("Signature"); removeChatBarButton("Signature");
removePreSendListener(handleMessage); removeMessagePreSendListener(handleMessage);
}, },

View file

@ -17,7 +17,7 @@
*/ */
import { addChatBarButton, ChatBarButton, removeChatBarButton } from "@api/ChatButtons"; import { addChatBarButton, ChatBarButton, removeChatBarButton } from "@api/ChatButtons";
import { addPreSendListener, removePreSendListener, SendListener } from "@api/MessageEvents"; import { addMessagePreSendListener, removeMessagePreSendListener, SendListener } from "@api/MessageEvents";
import { EquicordDevs } from "@utils/constants"; import { EquicordDevs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { React, useEffect, useState } from "@webpack/common"; import { React, useEffect, useState } from "@webpack/common";
@ -38,8 +38,8 @@ const ReverseMessageToggle: ChatBarButton = ({ isMainChat }) => {
if (enabled && message.content) message.content = message.content.split("").reverse().join(""); if (enabled && message.content) message.content = message.content.split("").reverse().join("");
}; };
addPreSendListener(listener); addMessagePreSendListener(listener);
return () => void removePreSendListener(listener); return () => void removeMessagePreSendListener(listener);
}, [enabled]); }, [enabled]);
if (!isMainChat) return null; if (!isMainChat) return null;

View file

@ -19,8 +19,8 @@
import "./style.css"; import "./style.css";
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu"; import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
import { addAccessory, removeAccessory } from "@api/MessageAccessories"; import { addMessageAccessory, removeMessageAccessory } from "@api/MessageAccessories";
import { addButton, removeButton } from "@api/MessagePopover"; import { addMessagePopoverButton, removeMessagePopoverButton } from "@api/MessagePopover";
import { Devs, EquicordDevs } from "@utils/constants"; import { Devs, EquicordDevs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { ChannelStore, Menu } from "@webpack/common"; import { ChannelStore, Menu } from "@webpack/common";
@ -56,9 +56,9 @@ export default definePlugin({
}, },
start() { start() {
addAccessory("ec-translation", props => <Accessory message={props.message} />); addMessageAccessory("ec-translation", props => <Accessory message={props.message} />);
addButton("ec-translate", message => { addMessagePopoverButton("ec-translate", message => {
if (!message.content) return null; if (!message.content) return null;
return { return {
@ -71,7 +71,7 @@ export default definePlugin({
}); });
}, },
stop() { stop() {
removeButton("ec-translate"); removeMessagePopoverButton("ec-translate");
removeAccessory("ec-translation"); removeMessageAccessory("ec-translation");
} }
}); });

View file

@ -18,8 +18,8 @@
import "./style.css"; import "./style.css";
import { addAccessory } from "@api/MessageAccessories"; import { addMessageAccessory } from "@api/MessageAccessories";
import { addButton } from "@api/MessagePopover"; import { addMessagePopoverButton } from "@api/MessagePopover";
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
@ -57,8 +57,8 @@ export default definePlugin({
description: "Converts metric units to Imperal units and vice versa", description: "Converts metric units to Imperal units and vice versa",
authors: [Devs.sadan], authors: [Devs.sadan],
start() { start() {
addAccessory("vc-converter", props => <ConverterAccessory message={props.message} />); addMessageAccessory("vc-converter", props => <ConverterAccessory message={props.message} />);
addButton("vc-converter", message => { addMessagePopoverButton("vc-converter", message => {
if (!message.content) return null; if (!message.content) return null;
return { return {
label: "Convert Units", label: "Convert Units",

View file

@ -17,7 +17,7 @@
*/ */
import { findOption, RequiredMessageOption } from "@api/Commands"; import { findOption, RequiredMessageOption } from "@api/Commands";
import { addPreEditListener, addPreSendListener, MessageObject, removePreEditListener, removePreSendListener } from "@api/MessageEvents"; import { addMessagePreEditListener, addMessagePreSendListener, MessageObject, removeMessagePreEditListener, removeMessagePreSendListener } from "@api/MessageEvents";
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
@ -199,14 +199,14 @@ export default definePlugin({
}, },
start() { start() {
this.preSend = addPreSendListener((_, msg) => this.onSend(msg)); this.preSend = addMessagePreSendListener((_, msg) => this.onSend(msg));
this.preEdit = addPreEditListener((_cid, _mid, msg) => this.preEdit = addMessagePreEditListener((_cid, _mid, msg) =>
this.onSend(msg) this.onSend(msg)
); );
}, },
stop() { stop() {
removePreSendListener(this.preSend); removeMessagePreSendListener(this.preSend);
removePreEditListener(this.preEdit); removeMessagePreEditListener(this.preEdit);
}, },
}); });

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { addPreSendListener, removePreSendListener, SendListener } from "@api/MessageEvents"; import { addMessagePreSendListener, removeMessagePreSendListener, SendListener } from "@api/MessageEvents";
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { Devs, EquicordDevs } from "@utils/constants"; import { Devs, EquicordDevs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
@ -39,9 +39,9 @@ export default definePlugin({
settings, settings,
start() { start() {
addPreSendListener(presendObject); addMessagePreSendListener(presendObject);
}, },
stop() { stop() {
removePreSendListener(presendObject); removeMessagePreSendListener(presendObject);
} }
}); });