Migrate All FindStoreLazy to src/webpack/common

This commit is contained in:
thororen1234 2026-08-01 23:04:13 -04:00
parent 90b40c3bfb
commit 2a50f26365
No known key found for this signature in database
56 changed files with 290 additions and 169 deletions

View file

@ -0,0 +1,9 @@
import { FluxStore } from "..";
export interface ApplicationStreamingSettingsState {
soundshareEnabled: boolean;
}
export class ApplicationStreamingSettingsStore extends FluxStore {
getState(): ApplicationStreamingSettingsState;
}

View file

@ -0,0 +1,9 @@
import { FluxStore } from "..";
export interface AuthSession {
id_hash: string;
}
export class AuthSessionsStore extends FluxStore {
getSessions(): AuthSession[];
}

View file

@ -0,0 +1,9 @@
import { FluxStore } from "..";
export interface AuthorizedAppToken {
id: string;
}
export class AuthorizedAppsStore extends FluxStore {
getNewestTokenForApplication(applicationId: string): AuthorizedAppToken | undefined;
}

View file

@ -0,0 +1,14 @@
import { FluxStore } from "..";
export interface ChannelMemberGroup {
count: number;
id: string;
}
export interface ChannelMemberProps {
groups: ChannelMemberGroup[];
}
export class ChannelMemberStore extends FluxStore {
getProps(guildId?: string, channelId?: string): ChannelMemberProps;
}

View file

@ -0,0 +1,6 @@
import { FluxStore } from "..";
export class ChannelSectionStore extends FluxStore {
getGuildSidebarState(guildId?: string): unknown;
getSidebarState(channelId?: string): unknown;
}

View file

@ -0,0 +1,5 @@
import { FluxStore } from "..";
export class ClientThemesBackgroundStore extends FluxStore {
gradientPreset: string | null;
}

View file

@ -0,0 +1,5 @@
import { FluxStore } from "..";
export class CollapsedVoiceChannelStore extends FluxStore {
isCollapsed(channelId: string): boolean;
}

View file

@ -0,0 +1,12 @@
import { FluxStore } from "..";
export interface ConnectedAccount {
id: string;
type: string;
revoked: boolean;
showActivity: boolean;
}
export class ConnectedAccountsStore extends FluxStore {
getAccounts(): ConnectedAccount[];
}

View file

@ -0,0 +1,6 @@
import { FluxStore } from "..";
export class ExpandedGuildFolderStore extends FluxStore {
getExpandedFolders(): Set<number>;
isFolderExpanded(folderId: number): boolean;
}

View file

@ -0,0 +1,8 @@
import { FluxStore } from "..";
export class GuildAvailabilityStore extends FluxStore {
totalGuilds: number;
totalUnavailableGuilds: number;
unavailableGuilds: string[];
isUnavailable(guildId: string): boolean;
}

View file

@ -0,0 +1,5 @@
import { FluxStore } from "..";
export class JoinedThreadsStore extends FluxStore {
isMuted(channelId: string): boolean;
}

View file

@ -0,0 +1,5 @@
import { FluxStore } from "..";
export class PrivateChannelSortStore extends FluxStore {
getPrivateChannelIds(): string[];
}

View file

@ -0,0 +1,5 @@
import { FluxStore, Message } from "..";
export class ReferencedMessageStore extends FluxStore {
getMessageByReference(reference: Message["messageReference"]): { message: Message; } | undefined;
}

View file

@ -0,0 +1,11 @@
import { FluxStore } from "..";
import { StandingState } from "../../enums";
export interface AccountStanding {
state: StandingState;
}
export class SafetyHubStore extends FluxStore {
getAccountStanding(): AccountStanding;
isInitialized(): boolean;
}

View file

@ -0,0 +1,16 @@
import { FluxStore } from "..";
export interface Session {
sessionId: string;
status: string;
active: boolean;
clientInfo: {
version: number;
os: string;
client: string;
};
}
export class SessionsStore extends FluxStore {
getSessions(): Record<string, Session>;
}

View file

@ -0,0 +1,15 @@
import { FluxStore } from "..";
export interface GuildFolder {
folderId: number | null;
folderName: string | null;
folderColor: number | null;
guildIds: string[];
expanded?: boolean;
}
export class SortedGuildStore extends FluxStore {
getFlattenedGuildIds(): string[];
getGuildFolderById(folderId: number): GuildFolder;
getGuildFolders(): GuildFolder[];
}

View file

@ -0,0 +1,10 @@
import { FluxStore } from "..";
export interface ThreadMemberListSection {
sectionId: string;
userIds: string[];
}
export class ThreadMemberListStore extends FluxStore {
getMemberListSections(channelId?: string): Record<string, ThreadMemberListSection>;
}

View file

@ -0,0 +1,5 @@
import { FluxStore } from "..";
export class UserGuildJoinRequestStore extends FluxStore {
computeGuildIds(): string[];
}

View file

@ -0,0 +1,5 @@
import { FluxStore } from "..";
export class UserProfileSettingsStore extends FluxStore {
getPendingChanges(guildId?: string): Record<string, any>;
}

View file

@ -3,18 +3,28 @@ export * from "./AccessibilityStore";
export * from "./ActiveJoinedThreadsStore";
export * from "./ApplicationCommandIndexStore";
export * from "./ApplicationStore";
export * from "./ApplicationStreamingSettingsStore";
export * from "./ApplicationStreamingStore";
export * from "./ApplicationStreamPreviewStore";
export * from "./AuthenticationStore";
export * from "./AuthorizedAppsStore";
export * from "./AuthSessionsStore";
export * from "./CallStore";
export * from "./ChannelMemberStore";
export * from "./ChannelRTCStore";
export * from "./ChannelSectionStore";
export * from "./ChannelStore";
export * from "./ClientThemesBackgroundStore";
export * from "./CollapsedVoiceChannelStore";
export * from "./ConnectedAccountsStore";
export * from "./DraftStore";
export * from "./EditMessageStore";
export * from "./EmojiStore";
export * from "./ExpandedGuildFolderStore";
export * from "./ExperimentStore";
export * from "./FluxStore";
export * from "./FriendsStore";
export * from "./GuildAvailabilityStore";
export * from "./GuildChannelStore";
export * from "./GuildMemberCountStore";
export * from "./GuildMemberStore";
@ -23,6 +33,7 @@ export * from "./GuildScheduledEventStore";
export * from "./GuildStore";
export * from "./InstantInviteStore";
export * from "./InviteStore";
export * from "./JoinedThreadsStore";
export * from "./LocaleStore";
export * from "./MediaEngineStore";
export * from "./MessageStore";
@ -32,23 +43,31 @@ export * from "./PendingReplyStore";
export * from "./PermissionStore";
export * from "./PopoutWindowStore";
export * from "./PresenceStore";
export * from "./PrivateChannelSortStore";
export * from "./QuestStore";
export * from "./ReadStateStore";
export * from "./ReferencedMessageStore";
export * from "./RelationshipStore";
export * from "./RTCConnectionStore";
export * from "./RunningGameStore";
export * from "./SafetyHubStore";
export * from "./SelectedChannelStore";
export * from "./SelectedGuildStore";
export * from "./SessionsStore";
export * from "./SoundboardStore";
export * from "./SortedGuildStore";
export * from "./SpellCheckStore";
export * from "./SpotifyStore";
export * from "./StickersStore";
export * from "./StreamerModeStore";
export * from "./ThemeStore";
export * from "./ThreadMemberListStore";
export * from "./TypingStore";
export * from "./UploadAttachmentStore";
export * from "./UserAffinitiesStore";
export * from "./UserGuildJoinRequestStore";
export * from "./UserGuildSettingsStore";
export * from "./UserProfileSettingsStore";
export * from "./UserProfileStore";
export * from "./UserSettingsProtoStore";
export * from "./UserStore";

View file

@ -6,15 +6,12 @@
import { classNameFactory } from "@utils/css";
import { Activity, Application } from "@vencord/discord-types";
import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack";
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
import { ApplicationStore } from "@webpack/common";
import { settings } from "./settings";
import { ActivityViewProps, ApplicationIcon } from "./types";
const ApplicationStore: {
getApplication: (id: string) => Application | null;
} = findStoreLazy("ApplicationStore");
const { fetchApplication }: {
fetchApplication: (id: string) => Promise<Application | null>;
} = findByPropsLazy("fetchApplication");
@ -33,7 +30,7 @@ export function getActivityApplication(activity: Activity | null) {
if (!application_id) return undefined;
let application = ApplicationStore.getApplication(application_id);
if (!application && fetchedApplications.has(application_id)) {
application = fetchedApplications.get(application_id) ?? null;
application = fetchedApplications.get(application_id)!;
}
return application ?? undefined;
}
@ -92,7 +89,7 @@ export function getApplicationIcons(activities: Activity[], preferSmall = false)
let application = ApplicationStore.getApplication(application_id);
if (!application) {
if (fetchedApplications.has(application_id)) {
application = fetchedApplications.get(application_id) as Application | null;
application = fetchedApplications.get(application_id)!;
} else {
fetchedApplications.set(application_id, null);
fetchApplication(application_id).then(app => {

View file

@ -11,8 +11,8 @@ import { BasicChannelTabsProps, ChannelTabsProps, clearStaleNavigationContext, c
import { classNameFactory } from "@utils/css";
import { classes } from "@utils/misc";
import { useForceUpdater } from "@utils/react";
import { findComponentByCodeLazy, findStoreLazy } from "@webpack";
import { Button, ContextMenuApi, FluxDispatcher, useCallback, useEffect, useRef, UserStore, useState, useStateFromStores } from "@webpack/common";
import { findComponentByCodeLazy } from "@webpack";
import { Button, ChannelRTCStore, ContextMenuApi, FluxDispatcher, useCallback, useEffect, useRef, UserStore, useState, useStateFromStores } from "@webpack/common";
import channelTabs from "..";
import BookmarkContainer, { HorizontalScroller } from "./BookmarkContainer";
@ -22,7 +22,6 @@ import { BasicContextMenu } from "./ContextMenus";
type TabSet = Record<string, ChannelTabsProps[]>;
const PlusSmallIcon = findComponentByCodeLazy("0v-5h5a1");
const ChannelRTCStore = findStoreLazy("ChannelRTCStore");
const cl = classNameFactory("vc-channeltabs-");
@ -97,7 +96,7 @@ export default function ChannelsTabsContainer(props: BasicChannelTabsProps) {
"newTabButtonBehavior"
]);
const GhostTabs = useGhostTabs();
const isFullscreen = useStateFromStores([ChannelRTCStore], () => ChannelRTCStore.isFullscreenInContext() ?? false);
const isFullscreen = useStateFromStores([], () => ChannelRTCStore.isFullscreenInContext() ?? false);
const _update = useForceUpdater();
const update = useCallback((save = true) => {

View file

@ -15,8 +15,8 @@ import { Devs, EquicordDevs, GUILD_ID, SUPPORT_CHANNEL_ID, SUPPORT_CHANNEL_IDS,
import { isAnyPluginDev } from "@utils/misc";
import definePlugin, { OptionType } from "@utils/types";
import { StandingState } from "@vencord/discord-types/enums";
import { findByCodeLazy, findStoreLazy } from "@webpack";
import { Alerts, ApplicationCommandIndexStore, NavigationRouter, React, SettingsRouter, UserGuildSettingsStore, UserStore, useStateFromStores, VoiceStateStore } from "@webpack/common";
import { findByCodeLazy } from "@webpack";
import { Alerts, ApplicationCommandIndexStore, NavigationRouter, React, SafetyHubStore, SettingsRouter, UserGuildSettingsStore, UserStore, useStateFromStores, VoiceStateStore } from "@webpack/common";
import { ComponentType } from "react";
import { PluginButtons } from "./pluginButtons";
@ -28,7 +28,6 @@ migratePluginToSettings(true, "EquicordHelper", "GuildTagSettings", "disableAdop
let clicked = false;
const SafetyHubStore = findStoreLazy("SafetyHubStore");
const fetchSafetyHub: () => Promise<void> = findByCodeLazy("SAFETY_HUB_FETCH_START");
const StandingConfig: Record<number, { label: string; hoverColor: string; Icon: ComponentType<any>; }> = {

View file

@ -10,8 +10,8 @@ import { Notice } from "@components/Notice";
import { EquicordDevs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { Channel, User, VoiceState } from "@vencord/discord-types";
import { findByPropsLazy, findStoreLazy } from "@webpack";
import { Menu, React, VoiceStateStore } from "@webpack/common";
import { findByPropsLazy } from "@webpack";
import { Menu, React, RelationshipStore, UserStore, VoiceStateStore } from "@webpack/common";
type TFollowedUserInfo = {
lastChannelId: string;
@ -27,8 +27,6 @@ interface UserContextProps {
let followedUserInfo: TFollowedUserInfo = null;
const voiceChannelAction = findByPropsLazy("selectVoiceChannel");
const UserStore = findStoreLazy("UserStore");
const RelationshipStore = findStoreLazy("RelationshipStore");
const settings = definePluginSettings({
onlyWhenInVoice: {

View file

@ -6,13 +6,12 @@
import * as DataStore from "@api/DataStore";
import { Guild } from "@vencord/discord-types";
import { findStoreLazy, proxyLazyWebpack } from "@webpack";
import { Flux, FluxDispatcher, GuildStore } from "@webpack/common";
import { proxyLazyWebpack } from "@webpack";
import { Flux, FluxDispatcher, GuildStore, SortedGuildStore } from "@webpack/common";
export const HiddenServersStore = proxyLazyWebpack(() => {
const { Store } = Flux;
const SortedGuildStore = findStoreLazy("SortedGuildStore");
const DB_KEY = "HideServers_servers";
class HiddenServersStore extends Store {
public _hiddenGuilds: Set<string> = new Set();

View file

@ -12,9 +12,7 @@ import { getGuildAcronym } from "@utils/discord";
import { classes } from "@utils/misc";
import { Guild, RenderModalProps } from "@vencord/discord-types";
import { findCssClassesLazy } from "@webpack";
import { Button, closeModal, IconUtils, Modal,openModal, useStateFromStores } from "@webpack/common";
import { SortedGuildStore } from "..";
import { Button, closeModal, IconUtils, Modal, openModal, SortedGuildStore, useStateFromStores } from "@webpack/common";
const cl = classNameFactory("vc-hideservers-");
const IconClasses = findCssClassesLazy("icon", "acronym", "childWrapper");

View file

@ -18,8 +18,7 @@ import {
import { EquicordDevs } from "@utils/constants";
import definePlugin from "@utils/types";
import { Guild } from "@vencord/discord-types";
import { findStoreLazy } from "@webpack";
import { Menu, React, useStateFromStores } from "@webpack/common";
import { Menu, React, SortedGuildStore, useStateFromStores } from "@webpack/common";
import hiddenServersButton from "./components/HiddenServersButton";
import { HiddenServersStore } from "./HiddenServersStore";
@ -39,8 +38,6 @@ type qsResult = {
};
};
export const SortedGuildStore = findStoreLazy("SortedGuildStore");
const Patch: NavContextMenuPatchCallback = (
children,
{ guild }: { guild: Guild; }

View file

@ -9,13 +9,12 @@ import "./styles.css";
import { Devs } from "@utils/constants";
import { classNameFactory } from "@utils/css";
import definePlugin from "@utils/types";
import { findComponentByCodeLazy, findStoreLazy } from "@webpack";
import { TypingStore, UserStore, useStateFromStores } from "@webpack/common";
import { findComponentByCodeLazy } from "@webpack";
import { PrivateChannelSortStore, TypingStore, UserStore, useStateFromStores } from "@webpack/common";
const cl = classNameFactory("vc-home-typing-");
const ThreeDots = findComponentByCodeLazy("Math.min(1,Math.max(", "dotRadius:");
const PrivateChannelSortStore = findStoreLazy("PrivateChannelSortStore") as { getPrivateChannelIds: () => string[]; };
export default definePlugin({
name: "HomeTyping",

View file

@ -10,8 +10,8 @@ import { Paragraph } from "@components/Paragraph";
import { Devs, EquicordDevs } from "@utils/constants";
import definePlugin from "@utils/types";
import { VoiceState } from "@vencord/discord-types";
import { findByCodeLazy, findStoreLazy } from "@webpack";
import { ChannelStore, MediaEngineStore, PermissionsBits, PermissionStore, SelectedChannelStore, showToast, Toasts, UserStore, VoiceActions, WindowStore } from "@webpack/common";
import { findByCodeLazy } from "@webpack";
import { ApplicationStreamingSettingsStore, ChannelStore, MediaEngineStore, PermissionsBits, PermissionStore, SelectedChannelStore, showToast, Toasts, UserStore, VoiceActions, WindowStore } from "@webpack/common";
import { getCurrentMedia, settings } from "./utils";
@ -19,7 +19,6 @@ let hasStreamed, isStreaming, streamKey;
const startStream = findByCodeLazy('type:"STREAM_START"');
const stopStream = findByCodeLazy('type:"STREAM_STOP"');
const StreamPreviewSettings = getUserSettingLazy("voiceAndVideo", "disableStreamPreviews")!;
const ApplicationStreamingSettingsStore = findStoreLazy("ApplicationStreamingSettingsStore");
async function autoStartStream(instant = true) {
if (!instant && !WindowStore.isFocused() && settings.store.focusDiscord) return;

View file

@ -5,16 +5,13 @@
*/
import { addContextMenuPatch, NavContextMenuPatchCallback, removeContextMenuPatch } from "@api/ContextMenu";
import { findStoreLazy } from "@webpack";
import { FluxDispatcher, Menu, MessageActions, React, Toasts, UserStore } from "@webpack/common";
import { FluxDispatcher, Menu, MessageActions, React, SortedGuildStore, Toasts, UserStore } from "@webpack/common";
import { openLogModal } from "../components/LogsModal";
import { deleteMessageIDB } from "../db";
import { settings } from "../index";
import { addToXAndRemoveFromOpposite, ListType, removeFromX } from ".";
const SortedGuildStore = findStoreLazy("SortedGuildStore");
const idFunctions = {
Folder: props =>
props?.folderId &&

View file

@ -17,8 +17,7 @@
*/
import { Settings } from "@api/Settings";
import { findStoreLazy } from "@webpack";
import { ChannelStore, SelectedChannelStore, UserStore } from "@webpack/common";
import { ChannelStore, SelectedChannelStore, UserGuildSettingsStore, UserStore } from "@webpack/common";
import { settings } from "../index";
import { LoggedMessageJSON } from "../types";
@ -78,8 +77,6 @@ interface ShouldIgnoreArguments {
const EPHEMERAL = 64;
const UserGuildSettingsStore = findStoreLazy("UserGuildSettingsStore");
/**
* the function `shouldIgnore` evaluates whether a message should be ignored or kept, following a priority hierarchy: User > Channel > Server.
* In this hierarchy, whitelisting takes priority; if any element (User, Channel, or Server) is whitelisted, the message is kept.
@ -151,8 +148,8 @@ export function shouldIgnore({ channelId, authorId, guildId, flags, bot, ghostPi
if (isBlacklisted && (!isAuthorWhitelisted || !isChannelWhitelisted)) return true; // ignore
if (guildId != null && shouldIgnoreMutedGuilds && UserGuildSettingsStore.isMuted(guildId)) return true; // ignore
if (channelId != null && shouldIgnoreMutedCategories && UserGuildSettingsStore.isCategoryMuted(guildId, channelId)) return true; // ignore
if (channelId != null && shouldIgnoreMutedChannels && UserGuildSettingsStore.isChannelMuted(guildId, channelId)) return true; // ignore
if (channelId != null && shouldIgnoreMutedCategories && UserGuildSettingsStore.isCategoryMuted(guildId!, channelId)) return true; // ignore
if (channelId != null && shouldIgnoreMutedChannels && UserGuildSettingsStore.isChannelMuted(guildId!, channelId)) return true; // ignore
return false; // keep;
}

View file

@ -8,7 +8,6 @@ import { showNotification } from "@api/Notifications";
import { definePluginSettings } from "@api/Settings";
import { EquicordDevs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { findStoreLazy } from "@webpack";
import {
ChannelStore,
GuildStore,
@ -16,11 +15,10 @@ import {
PresenceStore,
RelationshipStore,
SelectedChannelStore,
UserGuildSettingsStore,
UserStore
} from "@webpack/common";
const UserGuildSettingsStore = findStoreLazy("UserGuildSettingsStore");
const settings = definePluginSettings({
friends: {
type: OptionType.BOOLEAN,
@ -61,7 +59,7 @@ function checkIfMuted(channel) {
if (!settings.store.ignoreMuted) return false;
if (!channel) return false;
if (channel.isMuted?.()) return true;
if (channel.isMuted()) return true;
const isDM = [1, 3].includes(channel.type);
if (isDM) {
@ -69,17 +67,15 @@ function checkIfMuted(channel) {
for (const userId of recipientIds) {
if (RelationshipStore.isBlocked(userId)) return true;
}
if (UserGuildSettingsStore?.getMutedChannels?.()?.includes?.(channel.id)) return true;
}
if (channel.guild_id) {
const guild = GuildStore.getGuild(channel.guild_id);
if (UserGuildSettingsStore.isMuted(channel.guild_id)) return true;
if (UserGuildSettingsStore?.isMuted?.(channel.guild_id)) return true;
if (UserGuildSettingsStore?.isChannelMuted?.(channel.guild_id, channel.id)) return true;
if (UserGuildSettingsStore?.isCategoryMuted?.(channel.guild_id, channel.id)) return true;
if (UserGuildSettingsStore.isMuted(channel.guild_id)) return true;
if (UserGuildSettingsStore.isChannelMuted(channel.guild_id, channel.id)) return true;
if (UserGuildSettingsStore.isCategoryMuted(channel.guild_id, channel.id)) return true;
}
return false;

View file

@ -6,17 +6,14 @@
import { isNonNullish } from "@utils/guards";
import { ProfilePreset } from "@vencord/discord-types";
import { findStoreLazy } from "@webpack";
import { showToast, Toasts } from "@webpack/common";
import { showToast, Toasts, UserProfileSettingsStore } from "@webpack/common";
import { getCurrentProfile } from "./profile";
import { addPreset, movePresetInArray, presets, PresetSection, type ProfilePresetEx, removePreset, replaceAllPresets, savePresetsData, updatePreset } from "./storage";
const UserProfileSettingsStore = findStoreLazy("UserProfileSettingsStore");
function isImageInput(value: unknown): value is string | { imageUri: string; } {
if (typeof value === "string") return value.length > 0;
return typeof value === "object" && isNonNullish(value) && "imageUri" in value && typeof (value as { imageUri: unknown }).imageUri === "string";
return typeof value === "object" && isNonNullish(value) && "imageUri" in value && typeof (value as { imageUri: unknown; }).imageUri === "string";
}
function getFreshPendingAvatar(section: PresetSection, guildId?: string): string | null {

View file

@ -6,10 +6,8 @@
import { getUserSettingLazy } from "@api/UserSettings";
import { AvatarDecorationData, CustomStatus, DisplayNameStyles, Nameplate, ProfileEffect, ProfilePreset } from "@vencord/discord-types";
import { findStoreLazy } from "@webpack";
import { FluxDispatcher, GuildMemberStore, IconUtils, UserProfileStore, UserStore } from "@webpack/common";
import { FluxDispatcher, GuildMemberStore, IconUtils, UserProfileSettingsStore, UserProfileStore, UserStore } from "@webpack/common";
const UserProfileSettingsStore = findStoreLazy("UserProfileSettingsStore");
const CustomStatusSettings = getUserSettingLazy("status", "customStatus")!;
type PendingChanges = Record<string, unknown> & {
@ -28,7 +26,7 @@ type PendingChanges = Record<string, unknown> & {
pendingPrimaryGuildId?: string | null;
};
type ImageInput = string | { imageUri: string; [key: string]: unknown; } | null | undefined;
type ImageInput = string | { imageUri: string;[key: string]: unknown; } | null | undefined;
type AvatarDecorationLike = AvatarDecorationData & {
label?: string;
type?: number;

View file

@ -8,14 +8,13 @@ import type { PluginNative } from "@utils/types";
import type { Quest, User } from "@vencord/discord-types";
import { QuestTaskType } from "@vencord/discord-types/enums";
import { findByCodeLazy, findLazy } from "@webpack";
import { FluxDispatcher, QuestStore, RestAPI, showToast, Toasts, UserStore } from "@webpack/common";
import { AuthorizedAppsStore, FluxDispatcher, QuestStore, RestAPI, showToast, Toasts, UserStore } from "@webpack/common";
import { getCurrentUserId, getQuestifySettings } from "../settings/access";
import { autoCompleteQuestTaskTypes, isDesktopCompatible } from "../settings/def";
import { resetQuestsToResume } from "../settings/fetching";
import { getIgnoredQuestIDs } from "../settings/ignoredQuests";
import { rerenderQuests } from "../settings/rerender";
import { AuthorizedAppsStore } from "./fetching";
import { normalizeQuestName } from "./filtering";
import { QL } from "./logging";
import { getQuestStatus, getQuestStoredProgress, isVideoQuestTask, QuestStatus, QuestTask, refreshQuest } from "./questState";

View file

@ -9,7 +9,7 @@ import { showNotification } from "@api/Notifications";
import { sleep } from "@utils/misc";
import type { PluginNative } from "@utils/types";
import type { Quest } from "@vencord/discord-types";
import { findByCodeLazy, findStoreLazy } from "@webpack";
import { findByCodeLazy } from "@webpack";
import { QuestStore, RestAPI } from "@webpack/common";
import { NavigationRouter } from "@webpack/common/utils";
@ -19,7 +19,6 @@ import { getNewQuests, normalizeQuestName, type QuestIncludedTypes, questMatches
import { QL } from "./logging";
import { QUEST_PAGE } from "./ui";
export const AuthorizedAppsStore = findStoreLazy("AuthorizedAppsStore");
const QuestifyNative = VencordNative?.pluginHelpers?.Questify as PluginNative<typeof import("../native")> | undefined;
export function snakeToCamel(obj: any): any {

View file

@ -18,11 +18,11 @@ import {
findByPropsLazy,
findComponentByCodeLazy,
findCssClassesLazy,
findStoreLazy,
} from "@webpack";
import {
ChannelActionCreators,
ChannelRouter,
ChannelSectionStore,
ChannelStore,
FluxDispatcher,
GuildStore,
@ -79,8 +79,6 @@ const ChatInputTypes = findByPropsLazy("FORM", "NORMAL");
const Sidebars = findByPropsLazy("ThreadSidebar", "MessageRequestSidebar");
const ChatClasses = findCssClassesLazy("threadSidebarOpen", "loader");
const ChannelSectionStore = findStoreLazy("ChannelSectionStore");
const requireForumView = extractAndLoadChunksLazy(
["Missing channel in Channel.renderHeaderToolbar"],
/Promise\.all\(\[((?:\i\.e\("\d+"\),?)+)\]\)\.then\(\i\.bind\(\i,(\d+)\)\)[^}]{0,100}?name:"ForumChannel"/
@ -377,7 +375,7 @@ export default definePlugin({
const [channelSidebar, guildSidebar] = useStateFromStores(
[ChannelSectionStore, SelectedChannelStore, ChannelStore], () => {
const currentChannelId = SelectedChannelStore.getChannelId();
const currentGuildId = SelectedGuildStore.getGuildId();
const currentGuildId = SelectedGuildStore.getGuildId()!;
return [
ChannelSectionStore.getSidebarState(currentChannelId),
ChannelSectionStore.getGuildSidebarState(currentGuildId),

View file

@ -9,11 +9,9 @@ import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { Channel } from "@vencord/discord-types";
import { findComponentByCodeLazy, findStoreLazy } from "@webpack";
import { ReadStateStore, useStateFromStores } from "@webpack/common";
import { findComponentByCodeLazy } from "@webpack";
import { JoinedThreadsStore, ReadStateStore, UserGuildSettingsStore, useStateFromStores } from "@webpack/common";
const UserGuildSettingsStore = findStoreLazy("UserGuildSettingsStore");
const JoinedThreadsStore = findStoreLazy("JoinedThreadsStore");
const NumberBadge = findComponentByCodeLazy("BADGE_NOTIFICATION_BACKGROUND", "let{count:");
const settings = definePluginSettings({

View file

@ -7,13 +7,12 @@
import "./styles.css";
import { Icon, User } from "@vencord/discord-types";
import { findComponentByCodeLazy, findStoreLazy } from "@webpack";
import { Button, ChannelActionCreators, ChannelStore, GuildActions, MediaEngineStore, NavigationRouter, PermissionsBits, PermissionStore, Tooltip, UserStore, VoiceActions, VoiceStateStore } from "@webpack/common";
import { findComponentByCodeLazy } from "@webpack";
import { Button, ChannelActionCreators, ChannelStore, GuildActions, MediaEngineStore, NavigationRouter, PermissionsBits, PermissionStore, SoundboardStore, Tooltip, UserStore, VoiceActions, VoiceStateStore } from "@webpack/common";
import { JSX } from "react";
import { settings } from "./settings";
const SoundboardStore = findStoreLazy("SoundboardStore");
const DeafenIconSelf = findComponentByCodeLazy("M22.7 2.7a1", "1.4l20-20ZM17") as Icon;
const DeafenIconOther = findComponentByCodeLazy("M21.76.83a5.02", "M12.38") as Icon;
const ChatIcon = findComponentByCodeLazy(".css,d:\"M12 22a10") as Icon;

View file

@ -6,15 +6,12 @@
import { classes } from "@utils/misc";
import { Channel, RenderModalProps } from "@vencord/discord-types";
import { findStoreLazy } from "@webpack";
import { Modal, openModal, React, ScrollerThin } from "@webpack/common";
import { AccessibilityStore, Modal, openModal, React, ScrollerThin } from "@webpack/common";
import { clearLogs, getVcLogs, vcLogSubscribe } from "../logs";
import { cl } from "../utils";
import { VoiceChannelLogEntryComponent } from "./VoiceChannelLogEntryComponent";
const AccessibilityStore = findStoreLazy("AccessibilityStore");
export function openVoiceChannelLog(channel: Channel) {
return openModal(props => (
<VoiceChannelLogModal props={props} channel={channel} />

View file

@ -18,10 +18,10 @@
import ErrorBoundary from "@components/ErrorBoundary";
import { findComponentByCodeLazy } from "@webpack";
import { Animations, ChannelRTCStore, useStateFromStores } from "@webpack/common";
import { Animations, ChannelRTCStore, ExpandedGuildFolderStore, SortedGuildStore, useStateFromStores } from "@webpack/common";
import type { CSSProperties } from "react";
import { ExpandedGuildFolderStore, settings, SortedGuildStore } from ".";
import { settings } from ".";
const GuildsBar = findComponentByCodeLazy('("guildsnav")');
@ -29,11 +29,11 @@ function getExpandedFolderIds() {
const expandedFolders = ExpandedGuildFolderStore.getExpandedFolders();
const folders = SortedGuildStore.getGuildFolders();
const expandedFolderIds = new Set<string>();
const expandedFolderIds = new Set<number>();
for (const folder of folders) {
if (expandedFolders.has(folder.folderId) && folder.guildIds?.length) {
expandedFolderIds.add(folder.folderId);
if (expandedFolders.has(folder.folderId!) && folder.guildIds?.length) {
expandedFolderIds.add(folder.folderId!);
}
}

View file

@ -23,8 +23,8 @@ import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord";
import { Logger } from "@utils/Logger";
import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy, findStoreLazy } from "@webpack";
import { FluxDispatcher } from "@webpack/common";
import { findByPropsLazy } from "@webpack";
import { ExpandedGuildFolderStore, FluxDispatcher, SortedGuildStore } from "@webpack/common";
import { ReactNode } from "react";
import FolderSideBar from "./FolderSideBar";
@ -35,8 +35,6 @@ enum FolderIconDisplay {
MoreThanOneFolderExpanded
}
export const ExpandedGuildFolderStore = findStoreLazy("ExpandedGuildFolderStore");
export const SortedGuildStore = findStoreLazy("SortedGuildStore");
const FolderUtils = findByPropsLazy("move", "toggleGuildFolderExpand");
let lastGuildId = null as string | null;

View file

@ -24,14 +24,13 @@ import ErrorBoundary from "@components/ErrorBoundary";
import { Paragraph } from "@components/Paragraph";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { findComponentByCodeLazy, findCssClassesLazy, findStoreLazy } from "@webpack";
import { Constants, React, RestAPI, SettingsRouter, Tooltip } from "@webpack/common";
import { findComponentByCodeLazy, findCssClassesLazy } from "@webpack";
import { AuthSessionsStore, Constants, React, RestAPI, SettingsRouter, Tooltip } from "@webpack/common";
import { NewButton, RenameButton } from "./components/RenameButton";
import { Session, SessionInfo } from "./types";
import { cl, fetchNamesFromDataStore, getDefaultName, GetOsColor, GetPlatformIcon, savedSessionsCache, saveSessionsToDataStore } from "./utils";
const AuthSessionsStore = findStoreLazy("AuthSessionsStore");
const TimestampClasses = findCssClassesLazy("timestamp", "blockquoteContainer");
const BlobMask = findComponentByCodeLazy("!1,lowerBadgeSize:");
@ -172,7 +171,7 @@ export default definePlugin({
flux: {
USER_SETTINGS_ACCOUNT_RESET_AND_CLOSE_FORM() {
const lastFetchedHashes: string[] = AuthSessionsStore.getSessions().map((session: SessionInfo["session"]) => session.id_hash);
const lastFetchedHashes: string[] = AuthSessionsStore.getSessions().map(session => session.id_hash);
// Add new sessions to cache
lastFetchedHashes.forEach(idHash => {

View file

@ -11,13 +11,12 @@ import { relativeLuminance } from "@plugins/clientTheme/utils/colorUtils";
import { createOrUpdateThemeColorVars } from "@plugins/clientTheme/utils/styleUtils";
import { classNameFactory } from "@utils/css";
import { Margins } from "@utils/margins";
import { findByCodeLazy, findStoreLazy } from "@webpack";
import { Button, ColorPicker, ThemeStore, useStateFromStores } from "@webpack/common";
import { findByCodeLazy } from "@webpack";
import { Button, ClientThemesBackgroundStore, ColorPicker, ThemeStore, useStateFromStores } from "@webpack/common";
import { settings } from "..";
const saveClientTheme = findByCodeLazy('type:"UNSYNCED_USER_SETTINGS_UPDATE', '"system"===');
const NitroThemeStore = findStoreLazy("ClientThemesBackgroundStore");
const cl = classNameFactory("vc-clientTheme-");
@ -44,7 +43,7 @@ export function ThemeSettingsComponent() {
const isLightTheme = currentTheme === "light";
const oppositeTheme = isLightTheme ? "Dark" : "Light";
const nitroThemeEnabled = useStateFromStores([NitroThemeStore], () => NitroThemeStore.gradientPreset != null);
const nitroThemeEnabled = useStateFromStores([ClientThemesBackgroundStore], () => ClientThemesBackgroundStore.gradientPreset != null);
const selectedLuminance = relativeLuminance(settings.store.color);

View file

@ -23,22 +23,10 @@ import { getUserSettingLazy } from "@api/UserSettings";
import equicordToolbox from "@equicordplugins/equicordToolbox";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { FluxStore } from "@vencord/discord-types";
import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack";
import { Menu, Popout, useRef, useState, useStateFromStores } from "@webpack/common";
interface ConnectedAccount {
id: string;
type: string;
revoked: boolean;
showActivity: boolean;
}
interface ConnectedAccountsStore extends FluxStore {
getAccounts(): ConnectedAccount[];
}
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
import { ConnectedAccountsStore, Menu, Popout, useRef, useState, useStateFromStores } from "@webpack/common";
const Button = findComponentByCodeLazy(".GREEN,positionKeyStemOverride:");
const ConnectedAccountsStore = findStoreLazy("ConnectedAccountsStore") as ConnectedAccountsStore;
const ConnectedAccountActions = findByPropsLazy("setShowActivity");
const ShowCurrentGame = getUserSettingLazy<boolean>("status", "showCurrentGame")!;

View file

@ -6,9 +6,9 @@
import { getCurrentChannel } from "@utils/discord";
import { isObjectEmpty } from "@utils/misc";
import { ChannelStore, GuildMemberCountStore, PermissionsBits, PermissionStore, SelectedChannelStore, Tooltip, useEffect, useStateFromStores, VoiceStateStore } from "@webpack/common";
import { ChannelMemberStore, ChannelStore, GuildMemberCountStore, PermissionsBits, PermissionStore, SelectedChannelStore, ThreadMemberListStore, Tooltip, useEffect, useStateFromStores, VoiceStateStore } from "@webpack/common";
import { ChannelMemberStore, cl, numberFormat, settings, ThreadMemberListStore } from ".";
import { cl, numberFormat, settings } from ".";
import { CircleIcon } from "./CircleIcon";
import { OnlineMemberCountStore } from "./OnlineMemberCountStore";
import { VoiceIcon } from "./VoiceIcon";

View file

@ -23,18 +23,9 @@ import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { classNameFactory } from "@utils/css";
import definePlugin, { OptionType } from "@utils/types";
import { FluxStore } from "@vencord/discord-types";
import { findStoreLazy } from "@webpack";
import { MemberCount } from "./MemberCount";
export const ChannelMemberStore = findStoreLazy("ChannelMemberStore") as FluxStore & {
getProps(guildId?: string, channelId?: string): { groups: { count: number; id: string; }[]; };
};
export const ThreadMemberListStore = findStoreLazy("ThreadMemberListStore") as FluxStore & {
getMemberListSections(channelId?: string): { [sectionId: string]: { sectionId: string; userIds: string[]; }; };
};
export const settings = definePluginSettings({
toolTip: {
type: OptionType.BOOLEAN,

View file

@ -22,10 +22,7 @@ import { Devs, EquicordDevs } from "@utils/constants";
import { Logger } from "@utils/Logger";
import definePlugin, { OptionType } from "@utils/types";
import { Message, User } from "@vencord/discord-types";
import { findStoreLazy } from "@webpack";
import { MessageStore, RelationshipStore } from "@webpack/common";
const ReferencedMessageStore = findStoreLazy("ReferencedMessageStore");
import { MessageStore, ReferencedMessageStore, RelationshipStore } from "@webpack/common";
interface ChannelStreamDividerProps {
type: "DIVIDER",

View file

@ -4,9 +4,9 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { PinOrder, PrivateChannelSortStore, settings } from "@plugins/pinDms";
import { PinOrder, settings } from "@plugins/pinDms";
import { useForceUpdater } from "@utils/react";
import { UserStore } from "@webpack/common";
import { PrivateChannelSortStore, UserStore } from "@webpack/common";
export interface Category {
id: string;

View file

@ -12,7 +12,7 @@ import { Devs } from "@utils/constants";
import { classes } from "@utils/misc";
import definePlugin, { OptionType, StartAt } from "@utils/types";
import { Channel } from "@vencord/discord-types";
import { findCssClassesLazy, findStoreLazy } from "@webpack";
import { findCssClassesLazy } from "@webpack";
import { Clickable, ContextMenuApi, FluxDispatcher, Menu, React } from "@webpack/common";
import { contextMenus } from "./components/contextMenu";
@ -28,8 +28,6 @@ interface ChannelComponentProps {
const headerClasses = findCssClassesLazy("privateChannelsHeaderContainer", "headerText");
export const PrivateChannelSortStore = findStoreLazy("PrivateChannelSortStore") as { getPrivateChannelIds: () => string[]; };
export let instance: any;
export const enum PinOrder {

View file

@ -23,23 +23,8 @@ import { Devs, EquicordDevs } from "@utils/constants";
import { classes } from "@utils/misc";
import definePlugin, { OptionType } from "@utils/types";
import { DiscordPlatform, User } from "@vencord/discord-types";
import { filters, findStoreLazy, mapMangledModuleLazy } from "@webpack";
import { AuthenticationStore, PresenceStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common";
export interface Session {
sessionId: string;
status: string;
active: boolean;
clientInfo: {
version: number;
os: string;
client: string;
};
}
const SessionsStore = findStoreLazy("SessionsStore") as {
getSessions(): Record<string, Session>;
};
import { filters, mapMangledModuleLazy } from "@webpack";
import { AuthenticationStore, PresenceStore, SessionsStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common";
const { useStatusFillColor } = mapMangledModuleLazy([".5625*", "translate"], {
useStatusFillColor: filters.byCode(".hex")

View file

@ -18,11 +18,11 @@
import { getUniqueUsername, openUserProfile } from "@utils/discord";
import { ChannelType, RelationshipType } from "@vencord/discord-types/enums";
import { UserUtils } from "@webpack/common";
import { GuildAvailabilityStore, UserUtils } from "@webpack/common";
import settings from "./settings";
import { ChannelDelete, GuildDelete, RelationshipRemove } from "./types";
import { deleteGroup, deleteGuild, getGroup, getGuild, GuildAvailabilityStore, notify } from "./utils";
import { deleteGroup, deleteGuild, getGroup, getGuild, notify } from "./utils";
let manuallyRemovedFriend: string | undefined;
let manuallyRemovedGuild: string | undefined;

View file

@ -20,21 +20,12 @@ import * as DataStore from "@api/DataStore";
import { popNotice, showNotice } from "@api/Notices";
import { showNotification } from "@api/Notifications";
import { getUniqueUsername, openUserProfile } from "@utils/discord";
import { FluxStore } from "@vencord/discord-types";
import { ChannelType, RelationshipType } from "@vencord/discord-types/enums";
import { findStoreLazy } from "@webpack";
import { ChannelStore, GuildMemberStore, GuildStore, RelationshipStore, UserStore, UserUtils } from "@webpack/common";
import { ChannelStore, GuildAvailabilityStore, GuildMemberStore, GuildStore, RelationshipStore, UserStore, UserUtils } from "@webpack/common";
import settings from "./settings";
import { SimpleGroupChannel, SimpleGuild } from "./types";
export const GuildAvailabilityStore = findStoreLazy("GuildAvailabilityStore") as FluxStore & {
totalGuilds: number;
totalUnavailableGuilds: number;
unavailableGuilds: string[];
isUnavailable(guildId: string): boolean;
};
const guilds = new Map<string, SimpleGuild>();
const groups = new Map<string, SimpleGroupChannel>();
const friends = {

View file

@ -25,8 +25,7 @@ import ErrorBoundary from "@components/ErrorBoundary";
import { Devs, EquicordDevs } from "@utils/constants";
import { classNameFactory } from "@utils/css";
import definePlugin, { OptionType } from "@utils/types";
import { findStoreLazy } from "@webpack";
import { GuildStore, PresenceStore, RelationshipStore, Tooltip, useStateFromStores } from "@webpack/common";
import { GuildStore, PresenceStore, RelationshipStore, Tooltip, UserGuildJoinRequestStore, useStateFromStores } from "@webpack/common";
const enum IndicatorType {
SERVER = 1 << 0,
@ -37,8 +36,6 @@ const enum IndicatorType {
let onlineFriendsCount = 0;
let guildCount = 0;
const UserGuildJoinRequestStore = findStoreLazy("UserGuildJoinRequestStore");
function FriendsIndicator() {
onlineFriendsCount = useStateFromStores([RelationshipStore, PresenceStore], () => {
let count = 0;

View file

@ -19,15 +19,13 @@ import { Devs, EquicordDevs } from "@utils/constants";
import { classNameFactory } from "@utils/index";
import definePlugin, { OptionType } from "@utils/types";
import { GuildMember, Message, RenderModalProps, User } from "@vencord/discord-types";
import { findByCodeLazy, findStoreLazy } from "@webpack";
import { ChannelStore, GuildMemberStore, GuildStore, Menu, MessageStore, Modal, openModal, RelationshipStore, StreamerModeStore, TextInput, useEffect, useState } from "@webpack/common";
import { findByCodeLazy } from "@webpack";
import { AccessibilityStore, ChannelStore, GuildMemberStore, GuildStore, Menu, MessageStore, Modal, openModal, RelationshipStore, StreamerModeStore, TextInput, useEffect, UserStore, useState } from "@webpack/common";
import { JSX } from "react";
const SMYNC = classNameFactory();
const UserStore = findStoreLazy("UserStore");
const wrapEmojis = findByCodeLazy("lastIndex;return");
const adjustColor = findByCodeLazy("light1", '.get("hsl.s"))');
const AccessibilityStore = findStoreLazy("AccessibilityStore");
const roleColorPattern = /^role((?:\+|-)\d{0,4})?$/iu;
const symbolPattern = /^[\p{S}\p{P}]{1,3}$/iu;

View file

@ -88,6 +88,26 @@ export let UserAffinitiesStore: t.UserAffinitiesStore;
export let ApplicationStreamingStore: t.ApplicationStreamingStore;
export let ApplicationStreamPreviewStore: t.ApplicationStreamPreviewStore;
export let SortedGuildStore: t.SortedGuildStore;
export let JoinedThreadsStore: t.JoinedThreadsStore;
export let SafetyHubStore: t.SafetyHubStore;
export let PrivateChannelSortStore: t.PrivateChannelSortStore;
export let ApplicationStreamingSettingsStore: t.ApplicationStreamingSettingsStore;
export let UserProfileSettingsStore: t.UserProfileSettingsStore;
export let AuthorizedAppsStore: t.AuthorizedAppsStore;
export let ChannelSectionStore: t.ChannelSectionStore;
export let ExpandedGuildFolderStore: t.ExpandedGuildFolderStore;
export let AuthSessionsStore: t.AuthSessionsStore;
export let ClientThemesBackgroundStore: t.ClientThemesBackgroundStore;
export let ConnectedAccountsStore: t.ConnectedAccountsStore;
export let ChannelMemberStore: t.ChannelMemberStore;
export let ThreadMemberListStore: t.ThreadMemberListStore;
export let CollapsedVoiceChannelStore: t.CollapsedVoiceChannelStore;
export let ReferencedMessageStore: t.ReferencedMessageStore;
export let SessionsStore: t.SessionsStore;
export let GuildAvailabilityStore: t.GuildAvailabilityStore;
export let UserGuildJoinRequestStore: t.UserGuildJoinRequestStore;
/**
* @see jsdoc of {@link t.useStateFromStores}
*/
@ -146,6 +166,27 @@ waitForStore("QuestStore", m => QuestStore = m);
waitForStore("UserAffinitiesV2Store", m => UserAffinitiesStore = m);
waitForStore("ApplicationStreamingStore", m => ApplicationStreamingStore = m);
waitForStore("ApplicationStreamPreviewStore", m => ApplicationStreamPreviewStore = m);
waitForStore("SortedGuildStore", m => SortedGuildStore = m);
waitForStore("JoinedThreadsStore", m => JoinedThreadsStore = m);
waitForStore("SafetyHubStore", m => SafetyHubStore = m);
waitForStore("PrivateChannelSortStore", m => PrivateChannelSortStore = m);
waitForStore("ApplicationStreamingSettingsStore", m => ApplicationStreamingSettingsStore = m);
waitForStore("UserProfileSettingsStore", m => UserProfileSettingsStore = m);
waitForStore("AuthorizedAppsStore", m => AuthorizedAppsStore = m);
waitForStore("ChannelSectionStore", m => ChannelSectionStore = m);
waitForStore("ExpandedGuildFolderStore", m => ExpandedGuildFolderStore = m);
waitForStore("AuthSessionsStore", m => AuthSessionsStore = m);
waitForStore("ClientThemesBackgroundStore", m => ClientThemesBackgroundStore = m);
waitForStore("ConnectedAccountsStore", m => ConnectedAccountsStore = m);
waitForStore("ChannelMemberStore", m => ChannelMemberStore = m);
// comeback
waitForStore("ThreadMemberListStore", m => ThreadMemberListStore = m);
waitForStore("CollapsedVoiceChannelStore", m => CollapsedVoiceChannelStore = m);
waitForStore("ReferencedMessageStore", m => ReferencedMessageStore = m);
// comeback
waitForStore("SessionsStore", m => SessionsStore = m);
waitForStore("GuildAvailabilityStore", m => GuildAvailabilityStore = m);
waitForStore("UserGuildJoinRequestStore", m => UserGuildJoinRequestStore = m);
waitForStore("ThemeStore", m => {
ThemeStore = m;
// Importing this directly causes all webpack commons to be imported, which can easily cause circular dependencies.