From 0742cecd41177b233d3199faf4b3d02ae83dbdad Mon Sep 17 00:00:00 2001
From: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Date: Thu, 27 Jun 2024 22:20:58 -0300
Subject: [PATCH] clean commons
---
src/utils/modal.tsx | 4 ++--
src/webpack/common/components.ts | 8 ++++----
src/webpack/common/react.ts | 4 ++--
src/webpack/common/utils.ts | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/utils/modal.tsx b/src/utils/modal.tsx
index e11ddc6f2..380f08295 100644
--- a/src/utils/modal.tsx
+++ b/src/utils/modal.tsx
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-import { filters, find, findByProps, findComponentByCode } from "@webpack";
+import { findByProps, findComponentByCode } from "@webpack";
import type { ComponentType, PropsWithChildren, ReactNode, Ref } from "react";
import { NoopComponent } from "./react";
@@ -108,7 +108,7 @@ export let ModalContent: Modals["ModalContent"] = NoopComponent;
export let ModalFooter: Modals["ModalFooter"] = NoopComponent;
export let ModalCloseButton: Modals["ModalCloseButton"] = NoopComponent;
-export const Modals = find(filters.byProps("ModalRoot", "ModalCloseButton"), (m: Modals) => {
+export const Modals = findByProps("ModalRoot", "ModalCloseButton", (m: Modals) => {
({ ModalRoot, ModalHeader, ModalContent, ModalFooter, ModalCloseButton } = m);
return m;
diff --git a/src/webpack/common/components.ts b/src/webpack/common/components.ts
index 2b75deebc..2a251d5be 100644
--- a/src/webpack/common/components.ts
+++ b/src/webpack/common/components.ts
@@ -19,7 +19,7 @@
import { NoopComponent } from "@utils/react";
// eslint-disable-next-line path-alias/no-relative
-import { filters, find, findComponent, findExportedComponent } from "../api";
+import { filters, findByProps, findComponent, findComponentByCode, findExportedComponent } from "../api";
import * as t from "./types/components";
export let Card: t.Card = NoopComponent as any;
@@ -45,13 +45,13 @@ export let Avatar: t.Avatar = NoopComponent;
export let FocusLock: t.FocusLock = NoopComponent;
export let useToken: t.useToken;
-export const MaskedLink = findComponent(filters.byComponentCode("MASKED_LINK)"));
-export const Timestamp = findComponent(filters.byComponentCode(".Messages.MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL.format"));
+export const MaskedLink = findComponentByCode("MASKED_LINK)");
+export const Timestamp = findComponentByCode(".Messages.MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL.format");
export const Flex = findComponent(filters.byProps("Justify", "Align", "Wrap")) as t.Flex;
export const OAuth2AuthorizeModal = findExportedComponent("OAuth2AuthorizeModal");
-export const Forms = find(filters.byProps("FormItem", "Button"), m => {
+export const Forms = findByProps("FormItem", "Button", m => {
({
useToken,
Card,
diff --git a/src/webpack/common/react.ts b/src/webpack/common/react.ts
index 0707092a0..c3c26b10a 100644
--- a/src/webpack/common/react.ts
+++ b/src/webpack/common/react.ts
@@ -17,7 +17,7 @@
*/
// eslint-disable-next-line path-alias/no-relative
-import { filters, find, findByProps } from "../api";
+import { findByProps } from "../api";
export let useState: typeof React.useState;
export let useEffect: typeof React.useEffect;
@@ -28,7 +28,7 @@ export let useCallback: typeof React.useCallback;
export const ReactDOM = findByProps("createPortal", "render");
-export const React = find(filters.byProps("useState"), (m: typeof import("react")) => {
+export const React = findByProps("useState", (m: typeof import("react")) => {
({ useEffect, useState, useMemo, useRef, useReducer, useCallback } = m);
return m;
diff --git a/src/webpack/common/utils.ts b/src/webpack/common/utils.ts
index c15269fd9..250361c12 100644
--- a/src/webpack/common/utils.ts
+++ b/src/webpack/common/utils.ts
@@ -23,7 +23,7 @@ import { Channel } from "discord-types/general";
import { _resolveDiscordLoaded, filters, find, findByCode, findByProps, mapMangledModule, waitFor } from "../api";
import type * as t from "./types/utils";
-export const FluxDispatcher = find(filters.byProps("dispatch", "subscribe"), (m: t.FluxDispatcher) => {
+export const FluxDispatcher = findByProps("dispatch", "subscribe", (m: t.FluxDispatcher) => {
// Non import call to avoid circular dependency
Vencord.Plugins.subscribeAllPluginsFluxEvents(m);