diff --git a/src/plugins/automodContext/index.tsx b/src/plugins/automodContext/index.tsx index 08a2fa2a3..045d62721 100644 --- a/src/plugins/automodContext/index.tsx +++ b/src/plugins/automodContext/index.tsx @@ -7,10 +7,10 @@ import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import definePlugin from "@utils/types"; -import { findByProps } from "@webpack"; +import { findByPropsAndExtract } from "@webpack"; import { Button, ChannelStore, Text } from "@webpack/common"; -const { selectChannel } = findByProps("selectChannel", "selectVoiceChannel"); +const selectChannel = findByPropsAndExtract("selectChannel", "selectVoiceChannel"); function jumpToMessage(channelId: string, messageId: string) { const guildId = ChannelStore.getChannel(channelId)?.guild_id; diff --git a/src/plugins/copyEmojiMarkdown/index.tsx b/src/plugins/copyEmojiMarkdown/index.tsx index 42570fe75..2a01777d1 100644 --- a/src/plugins/copyEmojiMarkdown/index.tsx +++ b/src/plugins/copyEmojiMarkdown/index.tsx @@ -8,10 +8,10 @@ import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import { copyWithToast } from "@utils/misc"; import definePlugin, { OptionType } from "@utils/types"; -import { findByProps } from "@webpack"; +import { findByPropsAndExtract } from "@webpack"; import { Menu } from "@webpack/common"; -const { convertNameToSurrogate } = findByProps("convertNameToSurrogate"); +const convertNameToSurrogate = findByPropsAndExtract("convertNameToSurrogate"); interface Emoji { type: string; diff --git a/src/plugins/decor/ui/modals/CreateDecorationModal.tsx b/src/plugins/decor/ui/modals/CreateDecorationModal.tsx index e7b1db0f9..78535d4f0 100644 --- a/src/plugins/decor/ui/modals/CreateDecorationModal.tsx +++ b/src/plugins/decor/ui/modals/CreateDecorationModal.tsx @@ -9,7 +9,7 @@ import { Link } from "@components/Link"; import { openInviteModal } from "@utils/discord"; import { Margins } from "@utils/margins"; import { closeAllModals, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal"; -import { filters, findComponentByCode, mapMangledModule } from "@webpack"; +import { findByProps, findComponentByCode } from "@webpack"; import { Button, FluxDispatcher, Forms, GuildStore, NavigationRouter, Text, TextInput, useEffect, useMemo, UserStore, useState } from "@webpack/common"; import { GUILD_ID, INVITE_KEY, RAW_SKU_ID } from "../../lib/constants"; @@ -18,11 +18,8 @@ import { cl, DecorationModalStyles, requireAvatarDecorationModal, requireCreateS import { AvatarDecorationModalPreview } from "../components"; const FileUpload = findComponentByCode("fileUploadInput,"); - -const { HelpMessage, HelpMessageTypes } = mapMangledModule('POSITIVE=3]="POSITIVE', { - HelpMessageTypes: filters.byProps("POSITIVE", "WARNING"), - HelpMessage: filters.byCode(".iconDiv") -}); +const HelpMessage = findComponentByCode(".iconDiv,", "messageType"); +const HelpMessageTypes = findByProps("POSITIVE", "WARNING"); function useObjectURL(object: Blob | MediaSource | null) { const [url, setUrl] = useState(null); diff --git a/src/plugins/newGuildSettings/index.tsx b/src/plugins/newGuildSettings/index.tsx index 3d78236c2..bb0e6dd16 100644 --- a/src/plugins/newGuildSettings/index.tsx +++ b/src/plugins/newGuildSettings/index.tsx @@ -24,12 +24,12 @@ import { definePluginSettings, migratePluginSettings } from "@api/Settings"; import { CogWheel } from "@components/Icons"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; -import { findByCode, findByProps, mapMangledModule } from "@webpack"; +import { findByCode, findByPropsAndExtract, mapMangledModule } from "@webpack"; import { Menu } from "@webpack/common"; import { Guild } from "discord-types/general"; -const { updateGuildNotificationSettings } = findByProps("updateGuildNotificationSettings"); -const { toggleShowAllChannels } = mapMangledModule(".onboardExistingMember(", { +const updateGuildNotificationSettings = findByPropsAndExtract("updateGuildNotificationSettings"); +const OnboardingChannelUtils = mapMangledModule(".onboardExistingMember(", { toggleShowAllChannels: m => { const s = String(m); return s.length < 100 && !s.includes("onboardExistingMember") && !s.includes("getOptedInChannels"); @@ -111,7 +111,7 @@ function applyDefaultSettings(guildId: string | null) { }); } if (settings.store.showAllChannels && isOptInEnabledForGuild(guildId)) { - toggleShowAllChannels(guildId); + OnboardingChannelUtils.toggleShowAllChannels(guildId); } } diff --git a/src/plugins/replyTimestamp/index.tsx b/src/plugins/replyTimestamp/index.tsx index 9d60be973..b75847bd9 100644 --- a/src/plugins/replyTimestamp/index.tsx +++ b/src/plugins/replyTimestamp/index.tsx @@ -14,7 +14,7 @@ import { Timestamp } from "@webpack/common"; import type { Message } from "discord-types/general"; import type { HTMLAttributes } from "react"; -const { calendarFormat, dateFormat, isSameDay } = mapMangledModule("millisecondsInUnit:", { +const DateFormatUtils = mapMangledModule("millisecondsInUnit:", { calendarFormat: filters.byCode("sameElse"), dateFormat: filters.byCode(':").concat'), isSameDay: filters.byCode("Math.abs(+"), @@ -46,14 +46,14 @@ function ReplyTimestamp({ return ( [ - {isSameDay(refTimestamp, baseTimestamp) - ? dateFormat(refTimestamp, "LT") - : calendarFormat(refTimestamp) + {DateFormatUtils.isSameDay(refTimestamp, baseTimestamp) + ? DateFormatUtils.dateFormat(refTimestamp, "LT") + : DateFormatUtils.calendarFormat(refTimestamp) } ] diff --git a/src/plugins/validUser/index.tsx b/src/plugins/validUser/index.tsx index 4825cdaa3..603657cc4 100644 --- a/src/plugins/validUser/index.tsx +++ b/src/plugins/validUser/index.tsx @@ -22,11 +22,12 @@ import { isNonNullish } from "@utils/guards"; import { sleep } from "@utils/misc"; import { Queue } from "@utils/Queue"; import definePlugin from "@utils/types"; +import { webpackDependantLazy } from "@webpack"; import { Constants, FluxDispatcher, RestAPI, UserProfileStore, UserStore, useState } from "@webpack/common"; import { type ComponentType, type ReactNode } from "react"; // LYING to the type checker here -const UserFlags = Constants.UserFlags as Record; +const UserFlags = webpackDependantLazy(() => Constants.UserFlags as Record); const badges: Record = { active_developer: { id: "active_developer", description: "Active Developer", icon: "6bdc42827a38498929a4920da12695d9", link: "https://support-dev.discord.com/hc/en-us/articles/10113997751447" }, bug_hunter_level_1: { id: "bug_hunter_level_1", description: "Discord Bug Hunter", icon: "2717692c7dca7289b35297368a940dd0", link: "https://support.discord.com/hc/en-us/articles/360046057772-Discord-Bugs" },