diff --git a/src/api/Badges.ts b/src/api/Badges.ts index 0957bdbe5..ee2f3a30c 100644 --- a/src/api/Badges.ts +++ b/src/api/Badges.ts @@ -57,7 +57,7 @@ const Badges = new Set(); * Register a new badge with the Badges API * @param badge The badge to register */ -export function addBadge(badge: ProfileBadge) { +export function addProfileBadge(badge: ProfileBadge) { badge.component &&= ErrorBoundary.wrap(badge.component, { noop: true }); Badges.add(badge); } @@ -66,7 +66,7 @@ export function addBadge(badge: ProfileBadge) { * Unregister a badge from the Badges API * @param badge The badge to remove */ -export function removeBadge(badge: ProfileBadge) { +export function removeProfileBadge(badge: ProfileBadge) { return Badges.delete(badge); } diff --git a/src/api/MemberListDecorators.ts b/src/api/MemberListDecorators.ts index 0431d76c2..07422d7c4 100644 --- a/src/api/MemberListDecorators.ts +++ b/src/api/MemberListDecorators.ts @@ -43,11 +43,11 @@ type OnlyIn = "guilds" | "dms"; export const decorators = new Map(); -export function addDecorator(identifier: string, decorator: MemberListDecoratorFactory, onlyIn?: OnlyIn) { +export function addMemberListDecorator(identifier: string, decorator: MemberListDecoratorFactory, onlyIn?: OnlyIn) { decorators.set(identifier, { decorator, onlyIn }); } -export function removeDecorator(identifier: string) { +export function removeMemberListDecorator(identifier: string) { decorators.delete(identifier); } diff --git a/src/api/MessageAccessories.ts b/src/api/MessageAccessories.ts index ddc96906d..7b1bf594d 100644 --- a/src/api/MessageAccessories.ts +++ b/src/api/MessageAccessories.ts @@ -24,7 +24,7 @@ export type MessageAccessory = { export const accessories = new Map(); -export function addAccessory( +export function addMessageAccessory( identifier: string, callback: MessageAccessoryFactory, position?: number @@ -35,7 +35,7 @@ export function addAccessory( }); } -export function removeAccessory(identifier: string) { +export function removeMessageAccessory(identifier: string) { accessories.delete(identifier); } diff --git a/src/api/MessageDecorations.ts b/src/api/MessageDecorations.ts index 8de16dc91..adde9e516 100644 --- a/src/api/MessageDecorations.ts +++ b/src/api/MessageDecorations.ts @@ -48,11 +48,11 @@ export type MessageDecorationFactory = (props: MessageDecorationProps) => JSX.El export const decorations = new Map(); -export function addDecoration(identifier: string, decoration: MessageDecorationFactory) { +export function addMessageDecoration(identifier: string, decoration: MessageDecorationFactory) { decorations.set(identifier, decoration); } -export function removeDecoration(identifier: string) { +export function removeMessageDecoration(identifier: string) { decorations.delete(identifier); } diff --git a/src/api/MessageEvents.ts b/src/api/MessageEvents.ts index 12c651e3e..4fb38c6d5 100644 --- a/src/api/MessageEvents.ts +++ b/src/api/MessageEvents.ts @@ -147,11 +147,11 @@ export function _handleClick(message: Message, channel: Channel, event: MouseEve } } -export function addClickListener(listener: MessageClickListener) { +export function addMessageClickListener(listener: MessageClickListener) { listeners.add(listener); return listener; } -export function removeClickListener(listener: MessageClickListener) { +export function removeMessageClickListener(listener: MessageClickListener) { return listeners.delete(listener); } diff --git a/src/plugins/_core/supportHelper.tsx b/src/plugins/_core/supportHelper.tsx index 1b9ce162b..12dca2661 100644 --- a/src/plugins/_core/supportHelper.tsx +++ b/src/plugins/_core/supportHelper.tsx @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { addAccessory } from "@api/MessageAccessories"; +import { addMessageAccessory } from "@api/MessageAccessories"; import { definePluginSettings } from "@api/Settings"; import { getUserSettingLazy } from "@api/UserSettings"; import ErrorBoundary from "@components/ErrorBoundary"; @@ -251,7 +251,7 @@ export default definePlugin({ }, { noop: true }), start() { - addAccessory("vencord-debug", props => { + addMessageAccessory("vencord-debug", props => { const buttons = [] as JSX.Element[]; const shouldAddUpdateButton = diff --git a/src/plugins/index.ts b/src/plugins/index.ts index 7777cb836..089de70e9 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -19,10 +19,10 @@ import { addChatBarButton, removeChatBarButton } from "@api/ChatButtons"; import { registerCommand, unregisterCommand } from "@api/Commands"; import { addContextMenuPatch, removeContextMenuPatch } from "@api/ContextMenu"; -import { addDecorator, removeDecorator } from "@api/MemberListDecorators"; -import { addAccessory, removeAccessory } from "@api/MessageAccessories"; -import { addDecoration, removeDecoration } from "@api/MessageDecorations"; -import { addClickListener, addPreEditListener, addPreSendListener, removeClickListener, removePreEditListener, removePreSendListener } from "@api/MessageEvents"; +import { addMemberListDecorator, removeMemberListDecorator } from "@api/MemberListDecorators"; +import { addMessageAccessory, removeMessageAccessory } from "@api/MessageAccessories"; +import { addMessageDecoration, removeMessageDecoration } from "@api/MessageDecorations"; +import { addMessageClickListener, addPreEditListener, addPreSendListener, removeMessageClickListener, removePreEditListener, removePreSendListener } from "@api/MessageEvents"; import { addMessagePopoverButton, removeMessagePopoverButton } from "@api/MessagePopover"; import { Settings } from "@api/Settings"; import { Logger } from "@utils/Logger"; @@ -279,12 +279,12 @@ export const startPlugin = traceFunction("startPlugin", function startPlugin(p: if (onBeforeMessageEdit) addPreEditListener(onBeforeMessageEdit); if (onBeforeMessageSend) addPreSendListener(onBeforeMessageSend); - if (onMessageClick) addClickListener(onMessageClick); + if (onMessageClick) addMessageClickListener(onMessageClick); if (renderChatBarButton) addChatBarButton(name, renderChatBarButton); - if (renderMemberListDecorator) addDecorator(name, renderMemberListDecorator); - if (renderMessageDecoration) addDecoration(name, renderMessageDecoration); - if (renderMessageAccessory) addAccessory(name, renderMessageAccessory); + if (renderMemberListDecorator) addMemberListDecorator(name, renderMemberListDecorator); + if (renderMessageDecoration) addMessageDecoration(name, renderMessageDecoration); + if (renderMessageAccessory) addMessageAccessory(name, renderMessageAccessory); if (renderMessagePopoverButton) addMessagePopoverButton(name, renderMessagePopoverButton); return true; @@ -336,12 +336,12 @@ export const stopPlugin = traceFunction("stopPlugin", function stopPlugin(p: Plu if (onBeforeMessageEdit) removePreEditListener(onBeforeMessageEdit); if (onBeforeMessageSend) removePreSendListener(onBeforeMessageSend); - if (onMessageClick) removeClickListener(onMessageClick); + if (onMessageClick) removeMessageClickListener(onMessageClick); if (renderChatBarButton) removeChatBarButton(name); - if (renderMemberListDecorator) removeDecorator(name); - if (renderMessageDecoration) removeDecoration(name); - if (renderMessageAccessory) removeAccessory(name); + if (renderMemberListDecorator) removeMemberListDecorator(name); + if (renderMessageDecoration) removeMessageDecoration(name); + if (renderMessageAccessory) removeMessageAccessory(name); if (renderMessagePopoverButton) removeMessagePopoverButton(name); return true; diff --git a/src/plugins/messageClickActions/index.ts b/src/plugins/messageClickActions/index.ts index 7437cace7..5c32cb9b1 100644 --- a/src/plugins/messageClickActions/index.ts +++ b/src/plugins/messageClickActions/index.ts @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { addClickListener, removeClickListener } from "@api/MessageEvents"; +import { addMessageClickListener, removeMessageClickListener } from "@api/MessageEvents"; import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; @@ -65,7 +65,7 @@ export default definePlugin({ document.addEventListener("keydown", keydown); document.addEventListener("keyup", keyup); - this.onClick = addClickListener((msg: any, channel, event) => { + this.onClick = addMessageClickListener((msg: any, channel, event) => { const isMe = msg.author.id === UserStore.getCurrentUser().id; if (!isDeletePressed) { if (event.detail < 2) return; @@ -115,7 +115,7 @@ export default definePlugin({ }, stop() { - removeClickListener(this.onClick); + removeMessageClickListener(this.onClick); document.removeEventListener("keydown", keydown); document.removeEventListener("keyup", keyup); } diff --git a/src/plugins/messageLinkEmbeds/index.tsx b/src/plugins/messageLinkEmbeds/index.tsx index 9fd677389..3ed7e3c25 100644 --- a/src/plugins/messageLinkEmbeds/index.tsx +++ b/src/plugins/messageLinkEmbeds/index.tsx @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { addAccessory, removeAccessory } from "@api/MessageAccessories"; +import { addMessageAccessory, removeMessageAccessory } from "@api/MessageAccessories"; import { updateMessage } from "@api/MessageUpdater"; import { definePluginSettings } from "@api/Settings"; import { getUserSettingLazy } from "@api/UserSettings"; @@ -372,7 +372,7 @@ export default definePlugin({ settings, start() { - addAccessory("messageLinkEmbed", props => { + addMessageAccessory("messageLinkEmbed", props => { if (!messageLinkRegex.test(props.message.content)) return null; @@ -390,6 +390,6 @@ export default definePlugin({ }, stop() { - removeAccessory("messageLinkEmbed"); + removeMessageAccessory("messageLinkEmbed"); } }); diff --git a/src/plugins/platformIndicators/index.tsx b/src/plugins/platformIndicators/index.tsx index 1dc76e9d3..d2b722eff 100644 --- a/src/plugins/platformIndicators/index.tsx +++ b/src/plugins/platformIndicators/index.tsx @@ -18,9 +18,9 @@ import "./style.css"; -import { addBadge, BadgePosition, BadgeUserArgs, ProfileBadge, removeBadge } from "@api/Badges"; -import { addDecorator, removeDecorator } from "@api/MemberListDecorators"; -import { addDecoration, removeDecoration } from "@api/MessageDecorations"; +import { addProfileBadge, BadgePosition, BadgeUserArgs, ProfileBadge, removeProfileBadge } from "@api/Badges"; +import { addMemberListDecorator, removeMemberListDecorator } from "@api/MemberListDecorators"; +import { addMessageDecoration, removeMessageDecoration } from "@api/MessageDecorations"; import { Settings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; @@ -172,26 +172,26 @@ const badge: ProfileBadge = { const indicatorLocations = { list: { description: "In the member list", - onEnable: () => addDecorator("platform-indicator", props => + onEnable: () => addMemberListDecorator("platform-indicator", props => ), - onDisable: () => removeDecorator("platform-indicator") + onDisable: () => removeMemberListDecorator("platform-indicator") }, badges: { description: "In user profiles, as badges", - onEnable: () => addBadge(badge), - onDisable: () => removeBadge(badge) + onEnable: () => addProfileBadge(badge), + onDisable: () => removeProfileBadge(badge) }, messages: { description: "Inside messages", - onEnable: () => addDecoration("platform-indicator", props => + onEnable: () => addMessageDecoration("platform-indicator", props => ), - onDisable: () => removeDecoration("platform-indicator") + onDisable: () => removeMessageDecoration("platform-indicator") } }; diff --git a/src/plugins/translate/index.tsx b/src/plugins/translate/index.tsx index 2b0db104d..ed667ef33 100644 --- a/src/plugins/translate/index.tsx +++ b/src/plugins/translate/index.tsx @@ -20,7 +20,7 @@ import "./styles.css"; import { addChatBarButton, removeChatBarButton } from "@api/ChatButtons"; import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu"; -import { addAccessory, removeAccessory } from "@api/MessageAccessories"; +import { addMessageAccessory, removeMessageAccessory } from "@api/MessageAccessories"; import { addPreSendListener, removePreSendListener } from "@api/MessageEvents"; import { addMessagePopoverButton, removeMessagePopoverButton } from "@api/MessagePopover"; import { Devs } from "@utils/constants"; @@ -64,7 +64,7 @@ export default definePlugin({ translate, start() { - addAccessory("vc-translation", props => ); + addMessageAccessory("vc-translation", props => ); addChatBarButton("vc-translate", TranslateChatBarIcon); @@ -102,6 +102,6 @@ export default definePlugin({ removePreSendListener(this.preSend); removeChatBarButton("vc-translate"); removeMessagePopoverButton("vc-translate"); - removeAccessory("vc-translation"); + removeMessageAccessory("vc-translation"); }, }); diff --git a/src/plugins/userVoiceShow/index.tsx b/src/plugins/userVoiceShow/index.tsx index e0d5d8abd..f3063f590 100644 --- a/src/plugins/userVoiceShow/index.tsx +++ b/src/plugins/userVoiceShow/index.tsx @@ -18,8 +18,8 @@ import "./style.css"; -import { addDecorator, removeDecorator } from "@api/MemberListDecorators"; -import { addDecoration, removeDecoration } from "@api/MessageDecorations"; +import { addMemberListDecorator, removeMemberListDecorator } from "@api/MemberListDecorators"; +import { addMessageDecoration, removeMessageDecoration } from "@api/MessageDecorations"; import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; @@ -96,16 +96,16 @@ export default definePlugin({ start() { if (settings.store.showInMemberList) { - addDecorator("UserVoiceShow", ({ user }) => user == null ? null : ); + addMemberListDecorator("UserVoiceShow", ({ user }) => user == null ? null : ); } if (settings.store.showInMessages) { - addDecoration("UserVoiceShow", ({ message }) => message?.author == null ? null : ); + addMessageDecoration("UserVoiceShow", ({ message }) => message?.author == null ? null : ); } }, stop() { - removeDecorator("UserVoiceShow"); - removeDecoration("UserVoiceShow"); + removeMemberListDecorator("UserVoiceShow"); + removeMessageDecoration("UserVoiceShow"); }, VoiceChannelIndicator