diff --git a/src/equicordplugins/iconViewer/components/IconsTab.tsx b/src/equicordplugins/iconViewer/components/IconsTab.tsx index 2996e33ef..ca06e9797 100644 --- a/src/equicordplugins/iconViewer/components/IconsTab.tsx +++ b/src/equicordplugins/iconViewer/components/IconsTab.tsx @@ -16,7 +16,7 @@ import { Icon } from "@vencord/discord-types"; import { Clickable, TextInput, useCallback, useEffect, useMemo, useState } from "@webpack/common"; import { IconsDef } from "../types"; -import { getIconsModule } from "../utils"; +import { IconsModule } from "../utils"; import { openIconModal } from "./Modals"; let cachedIcons: IconsDef | null = null; @@ -24,9 +24,8 @@ let cachedIcons: IconsDef | null = null; function getIcons(): IconsDef { if (cachedIcons) return cachedIcons; - const iconsModule = getIconsModule(); cachedIcons = Object.fromEntries( - Object.entries(iconsModule).filter(([name, fn]) => + Object.entries(IconsModule).filter(([name, fn]) => typeof fn === "function" && name.endsWith("Icon") ) ); diff --git a/src/equicordplugins/iconViewer/utils.ts b/src/equicordplugins/iconViewer/utils.ts index 972a77e34..09f6e6a94 100644 --- a/src/equicordplugins/iconViewer/utils.ts +++ b/src/equicordplugins/iconViewer/utils.ts @@ -12,7 +12,7 @@ import { CssColorData, IconSize } from "./types"; let colorKeys: string[] = []; const Colors = findByPropsLazy("colors", "layout"); -const IconsModule = findByPropsLazy("AngleBracketsIcon", "StaffBadgeIcon") as Record; +export const IconsModule = findByPropsLazy("AngleBracketsIcon", "StaffBadgeIcon") as Record; export const iconSizesInPx: Record = findByPropsLazy("md", "lg", "xxs"); export const iconSizes: IconSize[] = ["xxs", "xs", "sm", "md", "lg"]; @@ -37,10 +37,6 @@ export const cssColors = new Proxy({} as Record, { } }); -export function getIconsModule(): Record { - return IconsModule; -} - waitFor(["colors", "layout"], m => { colorKeys = Object.keys(m.colors); }); diff --git a/src/equicordplugins/pinIcon/index.tsx b/src/equicordplugins/pinIcon/index.tsx index 2a0d9154c..1e6f5987f 100644 --- a/src/equicordplugins/pinIcon/index.tsx +++ b/src/equicordplugins/pinIcon/index.tsx @@ -16,9 +16,9 @@ * along with this program. If not, see . */ +import ErrorBoundary from "@components/ErrorBoundary"; import { EquicordDevs } from "@utils/constants"; import definePlugin from "@utils/types"; -import { Message } from "@vencord/discord-types"; import { findComponentByCodeLazy } from "@webpack"; const PinIcon = findComponentByCodeLazy("1-.06-.63L6.16"); @@ -31,11 +31,11 @@ export default definePlugin({ find: "isUnsupported})", replacement: { match: /WITH_CONTENT\}\)/, - replace: "$&,$self.PinnedIcon(arguments[0].message)" + replace: "$&,$self.renderPinIcon(arguments[0].message)" } } ], - PinnedIcon({ pinned }: Message) { - return pinned ? () : null; - } + renderPinIcon: ErrorBoundary.wrap(message => { + return message?.pinned ? () : null; + }, { noop: true }) }); diff --git a/src/equicordplugins/questionMarkReplacement/index.tsx b/src/equicordplugins/questionMarkReplacement/index.tsx deleted file mode 100644 index 1c9acf14f..000000000 --- a/src/equicordplugins/questionMarkReplacement/index.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 { definePluginSettings } from "@api/Settings"; -import { Devs } from "@utils/constants"; -import definePlugin, { OptionType } from "@utils/types"; - -const settings = definePluginSettings({ - replace: { - type: OptionType.STRING, - description: "Replace with", - default: ":face_with_monocle:" - }, -}); - -function replaceQuestionMarks(content: string): string { - const allQuestionMarks = content.split("").every(char => char === "?"); - - if (allQuestionMarks) { - return content.replace(/\?/g, settings.store.replace); - } else { - return content; - } -} - -export default definePlugin({ - name: "QuestionMarkReplacement", - description: "Replace all question marks with chosen string, if message only contains question marks.", - authors: [Devs.nyx], - - settings, - - start() { - this.preSend = addMessagePreSendListener((_, msg) => { - msg.content = replaceQuestionMarks(msg.content); - }); - }, - - stop() { - removeMessagePreSendListener(this.preSend); - } -});