Path aliases, better lazyWebpack (#268)

main
Ven 2 years ago committed by GitHub
parent 7a4402f142
commit bad96b7887
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import IpcEvents from "../src/utils/IpcEvents";
import * as DataStore from "../src/api/DataStore"; import * as DataStore from "../src/api/DataStore";
import IpcEvents from "../src/utils/IpcEvents";
// Discord deletes this so need to store in variable // Discord deletes this so need to store in variable
const { localStorage } = window; const { localStorage } = window;

@ -15,7 +15,7 @@ You don't need to run `pnpm build` every time you make a change. Instead, use `p
3. In `index.ts`, copy-paste the following template code: 3. In `index.ts`, copy-paste the following template code:
```ts ```ts
import definePlugin from "../../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "Epic Plugin", name: "Epic Plugin",

@ -16,10 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import IPC_EVENTS from "@utils/IpcEvents";
import { IpcRenderer, ipcRenderer } from "electron"; import { IpcRenderer, ipcRenderer } from "electron";
import IPC_EVENTS from "./utils/IpcEvents";
function assertEventAllowed(event: string) { function assertEventAllowed(event: string) {
if (!(event in IPC_EVENTS)) throw new Error(`Event ${event} not allowed.`); if (!(event in IPC_EVENTS)) throw new Error(`Event ${event} not allowed.`);
} }

@ -16,15 +16,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { mergeDefaults } from "@utils/misc";
import { findByCodeLazy, findByPropsLazy, waitFor } from "@webpack";
import { Message } from "discord-types/general"; import { Message } from "discord-types/general";
import type { PartialDeep } from "type-fest"; import type { PartialDeep } from "type-fest";
import { lazyWebpack, mergeDefaults } from "../../utils/misc";
import { filters, waitFor } from "../../webpack";
import { Argument } from "./types"; import { Argument } from "./types";
const createBotMessage = lazyWebpack(filters.byCode('username:"Clyde"')); const createBotMessage = findByCodeLazy('username:"Clyde"');
const MessageSender = lazyWebpack(filters.byProps("receiveMessage")); const MessageSender = findByPropsLazy("receiveMessage");
let SnowflakeUtils: any; let SnowflakeUtils: any;
waitFor("fromTimestamp", m => SnowflakeUtils = m); waitFor("fromTimestamp", m => SnowflakeUtils = m);

@ -16,7 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { makeCodeblock } from "../../utils/misc"; import { makeCodeblock } from "@utils/misc";
import { sendBotMessage } from "./commandHelpers"; import { sendBotMessage } from "./commandHelpers";
import { ApplicationCommandInputType, ApplicationCommandOptionType, ApplicationCommandType, Argument, Command, CommandContext, Option } from "./types"; import { ApplicationCommandInputType, ApplicationCommandOptionType, ApplicationCommandType, Argument, Command, CommandContext, Option } from "./types";

@ -16,11 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import Logger from "@utils/Logger";
import { MessageStore } from "@webpack/common";
import type { Channel, Message } from "discord-types/general"; import type { Channel, Message } from "discord-types/general";
import Logger from "../utils/Logger";
import { MessageStore } from "../webpack/common";
const MessageEventsLogger = new Logger("MessageEvents", "#e5c890"); const MessageEventsLogger = new Logger("MessageEvents", "#e5c890");
export interface Emoji { export interface Emoji {

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { waitFor } from "../webpack"; import { waitFor } from "@webpack";
let NoticesModule: any; let NoticesModule: any;
waitFor(m => m.show && m.dismiss && !m.suppressAll, m => NoticesModule = m); waitFor(m => m.show && m.dismiss && !m.suppressAll, m => NoticesModule = m);

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import Logger from "../utils/Logger"; import Logger from "@utils/Logger";
const logger = new Logger("ServerListAPI"); const logger = new Logger("ServerListAPI");

@ -16,13 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import plugins from "~plugins"; import IpcEvents from "@utils/IpcEvents";
import Logger from "@utils/Logger";
import { mergeDefaults } from "@utils/misc";
import { OptionType } from "@utils/types";
import { React } from "@webpack/common";
import IpcEvents from "../utils/IpcEvents"; import plugins from "~plugins";
import Logger from "../utils/Logger";
import { mergeDefaults } from "../utils/misc";
import { OptionType } from "../utils/types";
import { React } from "../webpack/common";
const logger = new Logger("Settings"); const logger = new Logger("Settings");
export interface Settings { export interface Settings {

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { React, TextInput } from "../webpack/common"; import { React, TextInput } from "@webpack/common";
// TODO: Refactor settings to use this as well // TODO: Refactor settings to use this as well
interface TextInputProps { interface TextInputProps {

@ -16,8 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import IpcEvents from "../utils/IpcEvents"; import IpcEvents from "@utils/IpcEvents";
import { Button } from "../webpack/common"; import { Button } from "@webpack/common";
import { Heart } from "./Heart"; import { Heart } from "./Heart";
export default function DonateButton(props: any) { export default function DonateButton(props: any) {

@ -16,9 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import Logger from "../utils/Logger"; import Logger from "@utils/Logger";
import { LazyComponent } from "../utils/misc"; import { LazyComponent } from "@utils/misc";
import { Margins, React } from "../webpack/common"; import { Margins, React } from "@webpack/common";
import { ErrorCard } from "./ErrorCard"; import { ErrorCard } from "./ErrorCard";
interface Props { interface Props {

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Card } from "../webpack/common"; import { Card } from "@webpack/common";
interface Props { interface Props {
style?: React.CSSProperties; style?: React.CSSProperties;

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import type { React } from "../webpack/common"; import type { React } from "@webpack/common";
export function Flex(props: React.PropsWithChildren<{ export function Flex(props: React.PropsWithChildren<{
flexDirection?: React.CSSProperties["flexDirection"]; flexDirection?: React.CSSProperties["flexDirection"];

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { React } from "../webpack/common"; import { React } from "@webpack/common";
interface Props extends React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> { interface Props extends React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> {
disabled?: boolean; disabled?: boolean;

@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import monacoHtml from "~fileContent/monacoWin.html"; import { debounce } from "@utils/debounce";
import IpcEvents from "@utils/IpcEvents";
import { Queue } from "@utils/Queue";
import { find } from "@webpack";
import { debounce } from "../utils/debounce"; import monacoHtml from "~fileContent/monacoWin.html";
import IpcEvents from "../utils/IpcEvents";
import { Queue } from "../utils/Queue";
import { find } from "../webpack/webpack";
const queue = new Queue(); const queue = new Queue();
const setCss = debounce((css: string) => { const setCss = debounce((css: string) => {

@ -16,10 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { debounce } from "../utils/debounce"; import { debounce } from "@utils/debounce";
import { makeCodeblock } from "../utils/misc"; import { makeCodeblock } from "@utils/misc";
import { Button, Clipboard, Forms, Margins, Parser, React, Switch, Text, TextInput } from "../webpack/common"; import { search } from "@webpack";
import { search } from "../webpack/webpack"; import { Button, Clipboard, Forms, Margins, Parser, React, Switch, Text, TextInput } from "@webpack/common";
import { CheckedTextInput } from "./CheckedTextInput"; import { CheckedTextInput } from "./CheckedTextInput";
import ErrorBoundary from "./ErrorBoundary"; import ErrorBoundary from "./ErrorBoundary";

@ -16,17 +16,17 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { generateId } from "@api/Commands";
import { useSettings } from "@api/settings";
import { LazyComponent } from "@utils/misc";
import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize } from "@utils/modal";
import { proxyLazy } from "@utils/proxyLazy";
import { OptionType, Plugin } from "@utils/types";
import { findByCode, findByPropsLazy } from "@webpack";
import { Button, FluxDispatcher, Forms, React, Text, Tooltip, UserStore, UserUtils } from "@webpack/common";
import { User } from "discord-types/general"; import { User } from "discord-types/general";
import { Constructor } from "type-fest"; import { Constructor } from "type-fest";
import { generateId } from "../../api/Commands";
import { useSettings } from "../../api/settings";
import { LazyComponent, lazyWebpack } from "../../utils/misc";
import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize } from "../../utils/modal";
import { proxyLazy } from "../../utils/proxyLazy";
import { OptionType, Plugin } from "../../utils/types";
import { filters, findByCode } from "../../webpack";
import { Button, FluxDispatcher, Forms, React, Text, Tooltip, UserStore, UserUtils } from "../../webpack/common";
import ErrorBoundary from "../ErrorBoundary"; import ErrorBoundary from "../ErrorBoundary";
import { Flex } from "../Flex"; import { Flex } from "../Flex";
import { import {
@ -40,7 +40,7 @@ import {
} from "./components"; } from "./components";
const UserSummaryItem = LazyComponent(() => findByCode("defaultRenderUser", "showDefaultAvatarsForNullUsers")); const UserSummaryItem = LazyComponent(() => findByCode("defaultRenderUser", "showDefaultAvatarsForNullUsers"));
const AvatarStyles = lazyWebpack(filters.byProps("moreUsers", "emptyUser", "avatarContainer", "clickableAvatar")); const AvatarStyles = findByPropsLazy("moreUsers", "emptyUser", "avatarContainer", "clickableAvatar");
const UserRecord: Constructor<Partial<User>> = proxyLazy(() => UserStore.getCurrentUser().constructor) as any; const UserRecord: Constructor<Partial<User>> = proxyLazy(() => UserStore.getCurrentUser().constructor) as any;
interface PluginModalProps extends ModalProps { interface PluginModalProps extends ModalProps {

@ -16,8 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { PluginOptionBoolean } from "../../../utils/types"; import { PluginOptionBoolean } from "@utils/types";
import { Forms, React, Select } from "../../../webpack/common"; import { Forms, React, Select } from "@webpack/common";
import { ISettingElementProps } from "."; import { ISettingElementProps } from ".";
export function SettingBooleanComponent({ option, pluginSettings, id, onChange, onError }: ISettingElementProps<PluginOptionBoolean>) { export function SettingBooleanComponent({ option, pluginSettings, id, onChange, onError }: ISettingElementProps<PluginOptionBoolean>) {

@ -16,7 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { PluginOptionComponent } from "../../../utils/types"; import { PluginOptionComponent } from "@utils/types";
import { ISettingElementProps } from "."; import { ISettingElementProps } from ".";
export function SettingCustomComponent({ option, onChange, onError }: ISettingElementProps<PluginOptionComponent>) { export function SettingCustomComponent({ option, onChange, onError }: ISettingElementProps<PluginOptionComponent>) {

@ -16,8 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { OptionType, PluginOptionNumber } from "../../../utils/types"; import { OptionType, PluginOptionNumber } from "@utils/types";
import { Forms, React, TextInput } from "../../../webpack/common"; import { Forms, React, TextInput } from "@webpack/common";
import { ISettingElementProps } from "."; import { ISettingElementProps } from ".";
const MAX_SAFE_NUMBER = BigInt(Number.MAX_SAFE_INTEGER); const MAX_SAFE_NUMBER = BigInt(Number.MAX_SAFE_INTEGER);

@ -16,8 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { PluginOptionSelect } from "../../../utils/types"; import { PluginOptionSelect } from "@utils/types";
import { Forms, React, Select } from "../../../webpack/common"; import { Forms, React, Select } from "@webpack/common";
import { ISettingElementProps } from "."; import { ISettingElementProps } from ".";
export function SettingSelectComponent({ option, pluginSettings, onChange, onError, id }: ISettingElementProps<PluginOptionSelect>) { export function SettingSelectComponent({ option, pluginSettings, onChange, onError, id }: ISettingElementProps<PluginOptionSelect>) {

@ -16,8 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { PluginOptionSlider } from "../../../utils/types"; import { PluginOptionSlider } from "@utils/types";
import { Forms, React, Slider } from "../../../webpack/common"; import { Forms, React, Slider } from "@webpack/common";
import { ISettingElementProps } from "."; import { ISettingElementProps } from ".";
export function makeRange(start: number, end: number, step = 1) { export function makeRange(start: number, end: number, step = 1) {

@ -16,8 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { PluginOptionString } from "../../../utils/types"; import { PluginOptionString } from "@utils/types";
import { Forms, React, TextInput } from "../../../webpack/common"; import { Forms, React, TextInput } from "@webpack/common";
import { ISettingElementProps } from "."; import { ISettingElementProps } from ".";
export function SettingTextComponent({ option, pluginSettings, id, onChange, onError }: ISettingElementProps<PluginOptionString>) { export function SettingTextComponent({ option, pluginSettings, id, onChange, onError }: ISettingElementProps<PluginOptionString>) {

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { PluginOptionBase } from "../../../utils/types"; import { PluginOptionBase } from "@utils/types";
export interface ISettingElementProps<T extends PluginOptionBase> { export interface ISettingElementProps<T extends PluginOptionBase> {
option: T; option: T;
@ -35,3 +35,4 @@ export * from "./SettingNumericComponent";
export * from "./SettingSelectComponent"; export * from "./SettingSelectComponent";
export * from "./SettingSliderComponent"; export * from "./SettingSliderComponent";
export * from "./SettingTextComponent"; export * from "./SettingTextComponent";

@ -16,18 +16,19 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { showNotice } from "@api/Notices";
import { Settings, useSettings } from "@api/settings";
import { ChangeList } from "@utils/ChangeList";
import Logger from "@utils/Logger";
import { classes, LazyComponent } from "@utils/misc";
import { openModalLazy } from "@utils/modal";
import { Plugin } from "@utils/types";
import { findByCode, findByPropsLazy } from "@webpack";
import { Alerts, Button, Forms, Margins, Parser, React, Select, Switch, Text, TextInput, Toasts, Tooltip } from "@webpack/common";
import Plugins from "~plugins"; import Plugins from "~plugins";
import { showNotice } from "../../api/Notices";
import { Settings, useSettings } from "../../api/settings";
import { startDependenciesRecursive, startPlugin, stopPlugin } from "../../plugins"; import { startDependenciesRecursive, startPlugin, stopPlugin } from "../../plugins";
import { ChangeList } from "../../utils/ChangeList";
import Logger from "../../utils/Logger";
import { classes, LazyComponent, lazyWebpack } from "../../utils/misc";
import { openModalLazy } from "../../utils/modal";
import { Plugin } from "../../utils/types";
import { filters, findByCode } from "../../webpack";
import { Alerts, Button, Forms, Margins, Parser, React, Select, Switch, Text, TextInput, Toasts, Tooltip } from "../../webpack/common";
import ErrorBoundary from "../ErrorBoundary"; import ErrorBoundary from "../ErrorBoundary";
import { ErrorCard } from "../ErrorCard"; import { ErrorCard } from "../ErrorCard";
import { Flex } from "../Flex"; import { Flex } from "../Flex";
@ -37,7 +38,7 @@ import * as styles from "./styles";
const logger = new Logger("PluginSettings", "#a6d189"); const logger = new Logger("PluginSettings", "#a6d189");
const InputStyles = lazyWebpack(filters.byProps("inputDefault", "inputWrapper")); const InputStyles = findByPropsLazy("inputDefault", "inputWrapper");
const CogWheel = LazyComponent(() => findByCode("18.564C15.797 19.099 14.932 19.498 14 19.738V22H10V19.738C9.069")); const CogWheel = LazyComponent(() => findByCode("18.564C15.797 19.099 14.932 19.498 14 19.738V22H10V19.738C9.069"));
const InfoIcon = LazyComponent(() => findByCode("4.4408921e-16 C4.4771525,-1.77635684e-15 4.4408921e-16")); const InfoIcon = LazyComponent(() => findByCode("4.4408921e-16 C4.4771525,-1.77635684e-15 4.4408921e-16"));

@ -16,8 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { downloadSettingsBackup, uploadSettingsBackup } from "../../utils/settingsSync"; import { downloadSettingsBackup, uploadSettingsBackup } from "@utils/settingsSync";
import { Button, Card, Forms, Margins, Text } from "../../webpack/common"; import { Button, Card, Forms, Margins, Text } from "@webpack/common";
import ErrorBoundary from "../ErrorBoundary"; import ErrorBoundary from "../ErrorBoundary";
import { Flex } from "../Flex"; import { Flex } from "../Flex";

@ -16,11 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { classes, useAwaiter } from "@utils/misc";
import { changes, checkForUpdates, getRepo, isNewer, rebuild, update, updateError, UpdateLogger } from "@utils/updater";
import { Alerts, Button, Card, Forms, Margins, Parser, React, Toasts } from "@webpack/common";
import gitHash from "~git-hash"; import gitHash from "~git-hash";
import { classes, useAwaiter } from "../../utils/misc";
import { changes, checkForUpdates, getRepo, isNewer, rebuild, update, updateError, UpdateLogger } from "../../utils/updater";
import { Alerts, Button, Card, Forms, Margins, Parser, React, Toasts } from "../../webpack/common";
import ErrorBoundary from "../ErrorBoundary"; import ErrorBoundary from "../ErrorBoundary";
import { ErrorCard } from "../ErrorCard"; import { ErrorCard } from "../ErrorCard";
import { Flex } from "../Flex"; import { Flex } from "../Flex";

@ -17,10 +17,11 @@
*/ */
import { useSettings } from "../../api/settings"; import { useSettings } from "@api/settings";
import IpcEvents from "../../utils/IpcEvents"; import IpcEvents from "@utils/IpcEvents";
import { useAwaiter } from "../../utils/misc"; import { useAwaiter } from "@utils/misc";
import { Button, Card, Forms, React, Switch } from "../../webpack/common"; import { Button, Card, Forms, React, Switch } from "@webpack/common";
import DonateButton from "../DonateButton"; import DonateButton from "../DonateButton";
import ErrorBoundary from "../ErrorBoundary"; import ErrorBoundary from "../ErrorBoundary";

@ -16,11 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { findByCodeLazy } from "@webpack";
import { Forms, Router, Text } from "@webpack/common";
import cssText from "~fileContent/settingsStyles.css"; import cssText from "~fileContent/settingsStyles.css";
import { lazyWebpack } from "../../utils/misc";
import { filters } from "../../webpack";
import { Forms, React, Router, Text } from "../../webpack/common";
import ErrorBoundary from "../ErrorBoundary"; import ErrorBoundary from "../ErrorBoundary";
import BackupRestoreTab from "./BackupRestoreTab"; import BackupRestoreTab from "./BackupRestoreTab";
import PluginsTab from "./PluginsTab"; import PluginsTab from "./PluginsTab";
@ -33,7 +33,7 @@ document.head.appendChild(style);
const st = (style: string) => `vcSettings${style}`; const st = (style: string) => `vcSettings${style}`;
const TabBar = lazyWebpack(filters.byCode('[role="tab"][aria-disabled="false"]')); const TabBar = findByCodeLazy('[role="tab"][aria-disabled="false"]');
interface SettingsProps { interface SettingsProps {
tab: string; tab: string;

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { isOutdated, rebuild, update } from "../utils/updater"; import { isOutdated, rebuild, update } from "@utils/updater";
export async function handleComponentFailed() { export async function handleComponentFailed() {
if (isOutdated) { if (isOutdated) {

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import Logger from "../utils/Logger"; import Logger from "@utils/Logger";
if (IS_DEV) { if (IS_DEV) {
var traces = {} as Record<string, [number, any[]]>; var traces = {} as Record<string, [number, any[]]>;

@ -18,6 +18,9 @@
import "./updater"; import "./updater";
import { debounce } from "@utils/debounce";
import IpcEvents from "@utils/IpcEvents";
import { Queue } from "@utils/Queue";
import { BrowserWindow, desktopCapturer, ipcMain, shell } from "electron"; import { BrowserWindow, desktopCapturer, ipcMain, shell } from "electron";
import { mkdirSync, readFileSync, watch } from "fs"; import { mkdirSync, readFileSync, watch } from "fs";
import { open, readFile, writeFile } from "fs/promises"; import { open, readFile, writeFile } from "fs/promises";
@ -25,9 +28,6 @@ import { join } from "path";
import monacoHtml from "~fileContent/../components/monacoWin.html;base64"; import monacoHtml from "~fileContent/../components/monacoWin.html;base64";
import { debounce } from "../utils/debounce";
import IpcEvents from "../utils/IpcEvents";
import { Queue } from "../utils/Queue";
import { ALLOWED_PROTOCOLS, QUICKCSS_PATH, SETTINGS_DIR, SETTINGS_FILE } from "./constants"; import { ALLOWED_PROTOCOLS, QUICKCSS_PATH, SETTINGS_DIR, SETTINGS_FILE } from "./constants";
mkdirSync(SETTINGS_DIR, { recursive: true }); mkdirSync(SETTINGS_DIR, { recursive: true });

@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import IpcEvents from "@utils/IpcEvents";
import { execFile as cpExecFile } from "child_process"; import { execFile as cpExecFile } from "child_process";
import { ipcMain } from "electron"; import { ipcMain } from "electron";
import { join } from "path"; import { join } from "path";
import { promisify } from "util"; import { promisify } from "util";
import IpcEvents from "../../utils/IpcEvents";
import { calculateHashes, serializeErrors } from "./common"; import { calculateHashes, serializeErrors } from "./common";
const VENCORD_SRC_DIR = join(__dirname, ".."); const VENCORD_SRC_DIR = join(__dirname, "..");

@ -16,6 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { VENCORD_USER_AGENT } from "@utils/constants";
import IpcEvents from "@utils/IpcEvents";
import { ipcMain } from "electron"; import { ipcMain } from "electron";
import { writeFile } from "fs/promises"; import { writeFile } from "fs/promises";
import { join } from "path"; import { join } from "path";
@ -23,8 +25,6 @@ import { join } from "path";
import gitHash from "~git-hash"; import gitHash from "~git-hash";
import gitRemote from "~git-remote"; import gitRemote from "~git-remote";
import { VENCORD_USER_AGENT } from "../../utils/constants";
import IpcEvents from "../../utils/IpcEvents";
import { get } from "../simpleGet"; import { get } from "../simpleGet";
import { calculateHashes, serializeErrors } from "./common"; import { calculateHashes, serializeErrors } from "./common";

2
src/modules.d.ts vendored

@ -20,7 +20,7 @@
/// <reference types="standalone-electron-types"/> /// <reference types="standalone-electron-types"/>
declare module "~plugins" { declare module "~plugins" {
const plugins: Record<string, import("./utils/types").Plugin>; const plugins: Record<string, import("@utils/types").Plugin>;
export default plugins; export default plugins;
} }

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { onceDefined } from "@utils/onceDefined";
import electron, { app, BrowserWindowConstructorOptions } from "electron"; import electron, { app, BrowserWindowConstructorOptions } from "electron";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
import { dirname, join } from "path"; import { dirname, join } from "path";
@ -23,7 +24,6 @@ import { dirname, join } from "path";
import { initIpc } from "./ipcMain"; import { initIpc } from "./ipcMain";
import { installExt } from "./ipcMain/extensions"; import { installExt } from "./ipcMain/extensions";
import { readSettings } from "./ipcMain/index"; import { readSettings } from "./ipcMain/index";
import { onceDefined } from "./utils/onceDefined";
console.log("[Vencord] Starting up..."); console.log("[Vencord] Starting up...");

@ -16,10 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Settings } from "../api/settings"; import { Settings } from "@api/settings";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import { makeLazy } from "../utils/misc"; import { makeLazy } from "@utils/misc";
import definePlugin, { OptionType } from "../utils/types"; import definePlugin, { OptionType } from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "BetterNotesBox", name: "BetterNotesBox",

@ -16,14 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { get, set } from "@api/DataStore";
import { Devs } from "@utils/constants";
import Logger from "@utils/Logger";
import definePlugin from "@utils/types";
import { ChannelStore, FluxDispatcher } from "@webpack/common";
import { Message } from "discord-types/general"; import { Message } from "discord-types/general";
import { get, set } from "../api/DataStore";
import { Devs } from "../utils/constants";
import Logger from "../utils/Logger";
import definePlugin from "../utils/types";
import { ChannelStore, FluxDispatcher } from "../webpack/common";
let style: HTMLStyleElement; let style: HTMLStyleElement;
const KEY = "HideAttachments_HiddenIds"; const KEY = "HideAttachments_HiddenIds";

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "TimeBarAllActivities", name: "TimeBarAllActivities",

@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Settings } from "@api/settings";
import definePlugin, { OptionType } from "../utils/types"; import { Devs } from "@utils/constants";
import { Settings } from "../Vencord"; import definePlugin, { OptionType } from "@utils/types";
enum Methods { enum Methods {
Random, Random,

@ -16,17 +16,17 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { BadgePosition, ProfileBadge } from "../api/Badges"; import { BadgePosition, ProfileBadge } from "@api/Badges";
import DonateButton from "../components/DonateButton"; import DonateButton from "@components/DonateButton";
import ErrorBoundary from "../components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { Flex } from "../components/Flex"; import { Flex } from "@components/Flex";
import { Heart } from "../components/Heart"; import { Heart } from "@components/Heart";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import IpcEvents from "../utils/IpcEvents"; import IpcEvents from "@utils/IpcEvents";
import Logger from "../utils/Logger"; import Logger from "@utils/Logger";
import { closeModal, Modals, openModal } from "../utils/modal"; import { closeModal, Modals, openModal } from "@utils/modal";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
import { Forms, Margins } from "../webpack/common"; import { Forms, Margins } from "@webpack/common";
const CONTRIBUTOR_BADGE = "https://media.discordapp.net/stickers/1026517526106087454.webp"; const CONTRIBUTOR_BADGE = "https://media.discordapp.net/stickers/1026517526106087454.webp";

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "CommandsAPI", name: "CommandsAPI",

@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { migratePluginSettings } from "../api/settings"; import { migratePluginSettings } from "@api/settings";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
// duplicate values have multiple branches with different types. Just include all to be safe // duplicate values have multiple branches with different types. Just include all to be safe
const nameMap = { const nameMap = {

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "MessageAccessoriesAPI", name: "MessageAccessoriesAPI",

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "MessageEventsAPI", name: "MessageEventsAPI",

@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { migratePluginSettings } from "../api/settings"; import { migratePluginSettings } from "@api/settings";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
migratePluginSettings("NoticesAPI", "NoticesApi"); migratePluginSettings("NoticesAPI", "NoticesApi");

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "ServerListAPI", name: "ServerListAPI",

@ -16,13 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { popNotice, showNotice } from "../api/Notices"; import { popNotice, showNotice } from "@api/Notices";
import { Link } from "../components/Link"; import { Link } from "@components/Link";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import { lazyWebpack } from "../utils/misc"; import definePlugin from "@utils/types";
import definePlugin from "../utils/types"; import { filters, findByCodeLazy, mapMangledModuleLazy } from "@webpack";
import { filters, mapMangledModuleLazy } from "../webpack"; import { FluxDispatcher, Forms, Toasts } from "@webpack/common";
import { FluxDispatcher, Forms, Toasts } from "../webpack/common";
const assetManager = mapMangledModuleLazy( const assetManager = mapMangledModuleLazy(
"getAssetImage: size must === [number, number] for Twitch", "getAssetImage: size must === [number, number] for Twitch",
@ -31,7 +30,7 @@ const assetManager = mapMangledModuleLazy(
} }
); );
const rpcManager = lazyWebpack(filters.byCode(".APPLICATION_RPC(")); const rpcManager = findByCodeLazy(".APPLICATION_RPC(");
async function lookupAsset(applicationId: string, key: string): Promise<string> { async function lookupAsset(applicationId: string, key: string): Promise<string> {
return (await assetManager.getAsset(applicationId, [key, undefined]))[0]; return (await assetManager.getAsset(applicationId, [key, undefined]))[0];

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "../utils/types"; import definePlugin, { OptionType } from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "BANger", name: "BANger",

@ -17,8 +17,8 @@
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "BetterGifAltText", name: "BetterGifAltText",

@ -16,10 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { migratePluginSettings, Settings } from "../api/settings"; import { migratePluginSettings, Settings } from "@api/settings";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "../utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { Clipboard, Toasts } from "../webpack/common"; import { Clipboard, Toasts } from "@webpack/common";
migratePluginSettings("BetterRoleDot", "ClickableRoleDot"); migratePluginSettings("BetterRoleDot", "ClickableRoleDot");
export default definePlugin({ export default definePlugin({

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "BetterUploadButton", name: "BetterUploadButton",

@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Settings } from "../api/settings"; import { Settings } from "@api/settings";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "../utils/types"; import definePlugin, { OptionType } from "@utils/types";
let style: HTMLStyleElement; let style: HTMLStyleElement;

@ -16,11 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Settings } from "../api/settings"; import { Settings } from "@api/settings";
import ErrorBoundary from "../components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "../utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { React } from "../webpack/common"; import { React } from "@webpack/common";
function formatDuration(ms: number) { function formatDuration(ms: number) {
// here be dragons (moment fucking sucks) // here be dragons (moment fucking sucks)

@ -22,10 +22,11 @@ import {
MessageObject, MessageObject,
removePreEditListener, removePreEditListener,
removePreSendListener removePreSendListener
} from "../../api/MessageEvents"; } from "@api/MessageEvents";
import { migratePluginSettings } from "../../api/settings"; import { migratePluginSettings } from "@api/settings";
import { Devs } from "../../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../../utils/types"; import definePlugin from "@utils/types";
import { defaultRules } from "./defaultRules"; import { defaultRules } from "./defaultRules";
// From lodash // From lodash

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
const WEB_ONLY = (f: string) => () => { const WEB_ONLY = (f: string) => () => {
throw new Error(`'${f}' is Discord Desktop only.`); throw new Error(`'${f}' is Discord Desktop only.`);

@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { ApplicationCommandOptionType, sendBotMessage } from "../api/Commands"; import { ApplicationCommandOptionType, sendBotMessage } from "@api/Commands";
import { findOption } from "../api/Commands/commandHelpers"; import { findOption } from "@api/Commands/commandHelpers";
import { ApplicationCommandInputType } from "../api/Commands/types"; import { ApplicationCommandInputType } from "@api/Commands/types";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
import { findByCode, findByProps } from "../webpack"; import { findByCode, findByProps } from "@webpack";
const DRAFT_TYPE = 0; const DRAFT_TYPE = 0;

@ -16,10 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { ApplicationCommandOptionType, sendBotMessage } from "../api/Commands"; import { ApplicationCommandOptionType, sendBotMessage } from "@api/Commands";
import { ApplicationCommandInputType } from "../api/Commands/types"; import { ApplicationCommandInputType } from "@api/Commands/types";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "UrbanDictionary", name: "UrbanDictionary",

@ -16,20 +16,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { migratePluginSettings, Settings } from "../api/settings"; import { migratePluginSettings, Settings } from "@api/settings";
import { CheckedTextInput } from "../components/CheckedTextInput"; import { CheckedTextInput } from "@components/CheckedTextInput";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import Logger from "../utils/Logger"; import Logger from "@utils/Logger";
import { lazyWebpack, makeLazy } from "../utils/misc"; import { makeLazy } from "@utils/misc";
import { ModalContent, ModalHeader, ModalRoot, openModal } from "../utils/modal"; import { ModalContent, ModalHeader, ModalRoot, openModal } from "@utils/modal";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
import { filters } from "../webpack"; import { findByCodeLazy, findByPropsLazy } from "@webpack";
import { Forms, GuildStore, Margins, Menu, PermissionStore, React, Toasts, Tooltip, UserStore } from "../webpack/common"; import { Forms, GuildStore, Margins, Menu, PermissionStore, React, Toasts, Tooltip, UserStore } from "@webpack/common";
const MANAGE_EMOJIS_AND_STICKERS = 1n << 30n; const MANAGE_EMOJIS_AND_STICKERS = 1n << 30n;
const GuildEmojiStore = lazyWebpack(filters.byProps("getGuilds", "getGuildEmoji")); const GuildEmojiStore = findByPropsLazy("getGuilds", "getGuildEmoji");
const uploadEmoji = lazyWebpack(filters.byCode('"EMOJI_UPLOAD_START"', "GUILD_EMOJIS(")); const uploadEmoji = findByCodeLazy('"EMOJI_UPLOAD_START"', "GUILD_EMOJIS(");
function getGuildCandidates(isAnimated: boolean) { function getGuildCandidates(isAnimated: boolean) {
const meId = UserStore.getCurrentUser().id; const meId = UserStore.getCurrentUser().id;

@ -16,14 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Settings } from "@api/settings";
import { lazyWebpack } from "../utils/misc"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "../utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { Settings } from "../Vencord"; import { findByPropsLazy } from "@webpack";
import { filters } from "../webpack"; import { Forms, React } from "@webpack/common";
import { Forms, React } from "../webpack/common";
const KbdStyles = lazyWebpack(filters.byProps("key", "removeBuildOverride")); const KbdStyles = findByPropsLazy("key", "removeBuildOverride");
export default definePlugin({ export default definePlugin({
name: "Experiments", name: "Experiments",

@ -16,18 +16,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { addPreEditListener, addPreSendListener, removePreEditListener, removePreSendListener } from "../api/MessageEvents"; import { addPreEditListener, addPreSendListener, removePreEditListener, removePreSendListener } from "@api/MessageEvents";
import { migratePluginSettings } from "../api/settings"; import { migratePluginSettings, Settings } from "@api/settings";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import { ApngDisposeOp, getGifEncoder, importApngJs } from "../utils/dependencies"; import { ApngDisposeOp, getGifEncoder, importApngJs } from "@utils/dependencies";
import { lazyWebpack } from "../utils/misc"; import definePlugin, { OptionType } from "@utils/types";
import definePlugin, { OptionType } from "../utils/types"; import { findByCodeLazy, findByPropsLazy } from "@webpack";
import { Settings } from "../Vencord"; import { ChannelStore, UserStore } from "@webpack/common";
import { filters } from "../webpack";
import { ChannelStore, UserStore } from "../webpack/common";
const DRAFT_TYPE = 0; const DRAFT_TYPE = 0;
const promptToUpload = lazyWebpack(filters.byCode("UPLOAD_FILE_LIMIT_ERROR")); const promptToUpload = findByCodeLazy("UPLOAD_FILE_LIMIT_ERROR");
interface BaseSticker { interface BaseSticker {
available: boolean; available: boolean;
@ -225,8 +223,8 @@ export default definePlugin({
return; return;
} }
const EmojiStore = lazyWebpack(filters.byProps("getCustomEmojiById")); const EmojiStore = findByPropsLazy("getCustomEmojiById");
const StickerStore = lazyWebpack(filters.byProps("getAllGuildStickers")) as { const StickerStore = findByPropsLazy("getAllGuildStickers") as {
getPremiumPacks(): StickerPack[]; getPremiumPacks(): StickerPack[];
getAllGuildStickers(): Map<string, Sticker[]>; getAllGuildStickers(): Map<string, Sticker[]>;
getStickerById(id: string): Sticker | undefined; getStickerById(id: string): Sticker | undefined;

@ -16,11 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { ApplicationCommandOptionType } from "../api/Commands"; import { ApplicationCommandOptionType } from "@api/Commands";
import { makeRange } from "../components/PluginSettings/components"; import { Settings } from "@api/settings";
import { Devs } from "../utils/constants"; import { makeRange } from "@components/PluginSettings/components";
import definePlugin, { OptionType } from "../utils/types"; import { Devs } from "@utils/constants";
import { Settings } from "../Vencord"; import definePlugin, { OptionType } from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "Fart2", name: "Fart2",

@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
import { waitFor } from "../webpack"; import { waitFor } from "@webpack";
let GuildStore; let GuildStore;
waitFor(["getGuild"], m => GuildStore = m); waitFor(["getGuild"], m => GuildStore = m);

@ -16,10 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { ApplicationCommandInputType, sendBotMessage } from "../api/Commands"; import { ApplicationCommandInputType, sendBotMessage } from "@api/Commands";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
import { findByProps } from "../webpack"; import { findByProps } from "@webpack";
export default definePlugin({ export default definePlugin({
name: "FriendInvites", name: "FriendInvites",

@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { addPreSendListener, MessageObject, removePreSendListener } from "../api/MessageEvents"; import { addPreSendListener, MessageObject, removePreSendListener } from "@api/MessageEvents";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
const re = /https?:\/\/twitter\.com(?=\/\w+?\/status\/)/g; const re = /https?:\/\/twitter\.com(?=\/\w+?\/status\/)/g;

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "iLoveSpam", name: "iLoveSpam",

@ -16,11 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { DataStore } from "../api"; import * as DataStore from "@api/DataStore";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import { lazyWebpack } from "../utils/misc"; import definePlugin from "@utils/types";
import definePlugin from "../utils/types"; import { findByPropsLazy } from "@webpack";
import { filters } from "../webpack";
interface MatchAndReplace { interface MatchAndReplace {
match: RegExp; match: RegExp;
@ -28,7 +27,7 @@ interface MatchAndReplace {
} }
/** Used to re-render the Registered Games tab to update how our button looks like */ /** Used to re-render the Registered Games tab to update how our button looks like */
const RunningGameStoreModule = lazyWebpack(filters.byProps("IgnoreActivities_reRenderGames")); const RunningGameStoreModule = findByPropsLazy("IgnoreActivities_reRenderGames");
let ignoredActivitiesCache: string[] = []; let ignoredActivitiesCache: string[] = [];

@ -16,13 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { registerCommand, unregisterCommand } from "@api/Commands";
import { Settings } from "@api/settings";
import Logger from "@utils/Logger";
import { Patch, Plugin } from "@utils/types";
import Plugins from "~plugins"; import Plugins from "~plugins";
import { registerCommand, unregisterCommand } from "../api/Commands";
import { Settings } from "../api/settings";
import { traceFunction } from "../debug/Tracer"; import { traceFunction } from "../debug/Tracer";
import Logger from "../utils/Logger";
import { Patch, Plugin } from "../utils/types";
const logger = new Logger("PluginManager", "#a6d189"); const logger = new Logger("PluginManager", "#a6d189");

@ -16,10 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { DataStore } from "../api"; import * as DataStore from "@api/DataStore";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
import { ChannelStore, FluxDispatcher, NavigationRouter, SelectedChannelStore, SelectedGuildStore } from "../webpack/common"; import { ChannelStore, FluxDispatcher, NavigationRouter, SelectedChannelStore, SelectedGuildStore } from "@webpack/common";
export interface LogoutEvent { export interface LogoutEvent {
type: "LOGOUT"; type: "LOGOUT";

@ -16,43 +16,43 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Link } from "../components/Link"; import { Settings } from "@api/settings";
import { Devs } from "../utils/constants"; import { Link } from "@components/Link";
import { lazyWebpack } from "../utils/misc"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "../utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { Settings, Webpack } from "../Vencord"; import { filters, findByPropsLazy, mapMangledModuleLazy } from "@webpack";
import { FluxDispatcher, Forms } from "../webpack/common"; import { FluxDispatcher, Forms } from "@webpack/common";
interface ActivityAssets { interface ActivityAssets {
large_image?: string large_image?: string;
large_text?: string large_text?: string;
small_image?: string small_image?: string;
small_text?: string small_text?: string;
} }
interface Activity { interface Activity {
state: string state: string;
details?: string details?: string;
timestamps?: { timestamps?: {
start?: Number start?: Number;
} };
assets?: ActivityAssets assets?: ActivityAssets;
buttons?: Array<string> buttons?: Array<string>;
name: string name: string;
application_id: string application_id: string;
metadata?: { metadata?: {
button_urls?: Array<string> button_urls?: Array<string>;
} };
type: Number type: Number;
flags: Number flags: Number;
} }
interface TrackData { interface TrackData {
name: string name: string;
album: string album: string;
artist: string artist: string;
url: string url: string;
imageUrl?: string imageUrl?: string;
} }
// only relevant enum values // only relevant enum values
@ -67,11 +67,11 @@ enum ActivityFlag {
const applicationId = "1043533871037284423"; const applicationId = "1043533871037284423";
const presenceStore = lazyWebpack(Webpack.filters.byProps("getLocalPresence")); const presenceStore = findByPropsLazy("getLocalPresence");
const assetManager = Webpack.mapMangledModuleLazy( const assetManager = mapMangledModuleLazy(
"getAssetImage: size must === [number, number] for Twitch", "getAssetImage: size must === [number, number] for Twitch",
{ {
getAsset: Webpack.filters.byCode("apply("), getAsset: filters.byCode("apply("),
} }
); );

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
// These are Xor encrypted to prevent you from spoiling yourself when you read the source code. // These are Xor encrypted to prevent you from spoiling yourself when you read the source code.
// don't worry about it :P // don't worry about it :P

@ -16,13 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { addClickListener, removeClickListener } from "../api/MessageEvents"; import { addClickListener, removeClickListener } from "@api/MessageEvents";
import { migratePluginSettings } from "../api/settings"; import { migratePluginSettings } from "@api/settings";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import { lazyWebpack } from "../utils/misc"; import definePlugin from "@utils/types";
import definePlugin from "../utils/types"; import { findByPropsLazy, findLazy } from "@webpack";
import { filters } from "../webpack"; import { UserStore } from "@webpack/common";
import { UserStore } from "../webpack/common";
let isDeletePressed = false; let isDeletePressed = false;
const keydown = (e: KeyboardEvent) => e.key === "Backspace" && (isDeletePressed = true); const keydown = (e: KeyboardEvent) => e.key === "Backspace" && (isDeletePressed = true);
@ -37,10 +36,10 @@ export default definePlugin({
dependencies: ["MessageEventsAPI"], dependencies: ["MessageEventsAPI"],
start() { start() {
const MessageActions = lazyWebpack(filters.byProps("deleteMessage", "startEditMessage")); const MessageActions = findByPropsLazy("deleteMessage", "startEditMessage");
const PermissionStore = lazyWebpack(filters.byProps("can", "initialize")); const PermissionStore = findByPropsLazy("can", "initialize");
const Permissions = lazyWebpack(m => typeof m.MANAGE_MESSAGES === "bigint"); const Permissions = findLazy(m => typeof m.MANAGE_MESSAGES === "bigint");
const EditStore = lazyWebpack(filters.byProps("isEditing", "isEditingAny")); const EditStore = findByPropsLazy("isEditing", "isEditingAny");
document.addEventListener("keydown", keydown); document.addEventListener("keydown", keydown);
document.addEventListener("keyup", keyup); document.addEventListener("keyup", keyup);

@ -16,14 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Settings } from "../../api/settings"; import { Settings } from "@api/settings";
import ErrorBoundary from "../../components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "../../utils/constants"; import { Devs } from "@utils/constants";
import Logger from "../../utils/Logger"; import Logger from "@utils/Logger";
import { lazyWebpack } from "../../utils/misc"; import definePlugin, { OptionType } from "@utils/types";
import definePlugin, { OptionType } from "../../utils/types"; import { findByPropsLazy } from "@webpack";
import { filters } from "../../webpack"; import { Parser, UserStore } from "@webpack/common";
import { Parser, UserStore } from "../../webpack/common";
function addDeleteStyleClass() { function addDeleteStyleClass() {
if (Settings.plugins.MessageLogger.deleteStyle === "text") { if (Settings.plugins.MessageLogger.deleteStyle === "text") {
@ -74,8 +73,8 @@ export default definePlugin({
`, `,
start() { start() {
this.moment = lazyWebpack(filters.byProps("relativeTimeRounding", "relativeTimeThreshold")); this.moment = findByPropsLazy("relativeTimeRounding", "relativeTimeThreshold");
this.timestampModule = lazyWebpack(filters.byProps("messageLogger_TimestampComponent")); this.timestampModule = findByPropsLazy("messageLogger_TimestampComponent");
const style = this.style = document.createElement("style"); const style = this.style = document.createElement("style");
style.textContent = this.css; style.textContent = this.css;

@ -16,11 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { DataStore } from "../api"; import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, registerCommand, sendBotMessage, unregisterCommand } from "@api/Commands";
import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, registerCommand, sendBotMessage, unregisterCommand } from "../api/Commands"; import * as DataStore from "@api/DataStore";
import { Settings } from "../api/settings"; import { Settings } from "@api/settings";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "../utils/types"; import definePlugin, { OptionType } from "@utils/types";
const EMOTE = "<:luna:1035316192220553236>"; const EMOTE = "<:luna:1035316192220553236>";
const DATA_KEY = "MessageTags_TAGS"; const DATA_KEY = "MessageTags_TAGS";

@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { ApplicationCommandInputType, findOption, OptionalMessageOption, RequiredMessageOption, sendBotMessage } from "../api/Commands"; import { ApplicationCommandInputType, findOption, OptionalMessageOption, RequiredMessageOption, sendBotMessage } from "@api/Commands";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
function mock(input: string): string { function mock(input: string): string {

@ -16,10 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { findOption, OptionalMessageOption } from "../api/Commands"; import { findOption, OptionalMessageOption } from "@api/Commands";
import { migratePluginSettings } from "../api/settings"; import { migratePluginSettings } from "@api/settings";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
migratePluginSettings("MoreKaomoji", "moarKaomojis"); migratePluginSettings("MoreKaomoji", "moarKaomojis");
export default definePlugin({ export default definePlugin({

@ -16,15 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Settings } from "@api/settings";
import { makeRange } from "@components/PluginSettings/components/SettingSliderComponent";
import { Devs } from "@utils/constants";
import { sleep } from "@utils/misc";
import definePlugin, { OptionType } from "@utils/types";
import { FluxDispatcher, SelectedChannelStore, UserStore } from "@webpack/common";
import { Message, ReactionEmoji } from "discord-types/general"; import { Message, ReactionEmoji } from "discord-types/general";
import { makeRange } from "../components/PluginSettings/components/SettingSliderComponent";
import { Devs } from "../utils/constants";
import { sleep } from "../utils/misc";
import definePlugin, { OptionType } from "../utils/types";
import { Settings } from "../Vencord";
import { FluxDispatcher, SelectedChannelStore, UserStore } from "../webpack/common";
interface IMessageCreate { interface IMessageCreate {
type: "MESSAGE_CREATE"; type: "MESSAGE_CREATE";
optimistic: boolean; optimistic: boolean;

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "MuteNewGuild", name: "MuteNewGuild",

@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Settings } from "@api/settings";
import { lazyWebpack } from "../utils/misc"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "../utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { Settings } from "../Vencord"; import { findByPropsLazy } from "@webpack";
import { filters } from "../webpack";
const RelationshipStore = lazyWebpack(filters.byProps("getRelationships", "isBlocked")); const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked");
export default definePlugin({ export default definePlugin({
name: "NoBlockedMessages", name: "NoBlockedMessages",

@ -16,10 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { addPreSendListener, MessageObject, removePreSendListener } from "../api/MessageEvents"; import { addPreSendListener, MessageObject, removePreSendListener } from "@api/MessageEvents";
import { Devs } from "../utils/constants"; import { Settings } from "@api/settings";
import definePlugin, { OptionType } from "../utils/types"; import { Devs } from "@utils/constants";
import { Settings } from "../Vencord"; import definePlugin, { OptionType } from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "NoCanaryMessageLinks", name: "NoCanaryMessageLinks",

@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { migratePluginSettings } from "../api/settings"; import { migratePluginSettings } from "@api/settings";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
migratePluginSettings("NoDevtoolsWarning", "STFU"); migratePluginSettings("NoDevtoolsWarning", "STFU");

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "No F1", name: "No F1",

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "No RPC", name: "No RPC",

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "NoReplyMention", name: "NoReplyMention",

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "NoSystemBadge", name: "NoSystemBadge",

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "NoTrack", name: "NoTrack",

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "oneko", name: "oneko",

@ -16,12 +16,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { ApplicationCommandInputType, ApplicationCommandOptionType, Argument, CommandContext, findOption, sendBotMessage } from "../api/Commands"; import { ApplicationCommandInputType, ApplicationCommandOptionType, Argument, CommandContext, findOption, sendBotMessage } from "@api/Commands";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import { getGifEncoder } from "../utils/dependencies"; import { getGifEncoder } from "@utils/dependencies";
import { lazyWebpack, makeLazy } from "../utils/misc"; import { makeLazy } from "@utils/misc";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
import { filters } from "../webpack"; import { findByCodeLazy, findByPropsLazy } from "@webpack";
const DRAFT_TYPE = 0; const DRAFT_TYPE = 0;
const DEFAULT_DELAY = 20; const DEFAULT_DELAY = 20;
@ -35,9 +35,9 @@ const getFrames = makeLazy(() => Promise.all(
)) ))
); );
const fetchUser = lazyWebpack(filters.byCode(".USER(")); const fetchUser = findByCodeLazy(".USER(");
const promptToUpload = lazyWebpack(filters.byCode("UPLOAD_FILE_LIMIT_ERROR")); const promptToUpload = findByCodeLazy("UPLOAD_FILE_LIMIT_ERROR");
const UploadStore = lazyWebpack(filters.byProps("getUploads")); const UploadStore = findByPropsLazy("getUploads");
function loadImage(source: File | string) { function loadImage(source: File | string) {
const isFile = source instanceof File; const isFile = source instanceof File;

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "PlainFolderIcon", name: "PlainFolderIcon",

@ -16,16 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Settings } from "@api/settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { findByCodeLazy } from "@webpack";
import { PresenceStore, Tooltip } from "@webpack/common";
import { User } from "discord-types/general"; import { User } from "discord-types/general";
import { Settings } from "../api/settings";
import ErrorBoundary from "../components/ErrorBoundary";
import { Devs } from "../utils/constants";
import { lazyWebpack } from "../utils/misc";
import definePlugin, { OptionType } from "../utils/types";
import { filters } from "../webpack";
import { PresenceStore, Tooltip } from "../webpack/common";
function Icon(path: string, viewBox = "0 0 24 24") { function Icon(path: string, viewBox = "0 0 24 24") {
return ({ color, tooltip }: { color: string; tooltip: string; }) => ( return ({ color, tooltip }: { color: string; tooltip: string; }) => (
<Tooltip text={tooltip} > <Tooltip text={tooltip} >
@ -52,7 +50,7 @@ const Icons = {
}; };
type Platform = keyof typeof Icons; type Platform = keyof typeof Icons;
const getStatusColor = lazyWebpack(filters.byCode("STATUS_YELLOW", "TWITCH", "STATUS_GREY")); const getStatusColor = findByCodeLazy("STATUS_YELLOW", "TWITCH", "STATUS_GREY");
const PlatformIcon = ({ platform, status }: { platform: Platform, status: string; }) => { const PlatformIcon = ({ platform, status }: { platform: Platform, status: string; }) => {
const tooltip = platform[0].toUpperCase() + platform.slice(1); const tooltip = platform[0].toUpperCase() + platform.slice(1);

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Link } from "../../../components/Link"; import { Link } from "@components/Link";
import { Forms, React } from "../../../webpack/common"; import { Forms, React } from "@webpack/common";
export default function PronounsAboutComponent() { export default function PronounsAboutComponent() {
return ( return (

@ -16,16 +16,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Settings } from "@api/settings";
import { classes, useAwaiter } from "@utils/misc";
import { findByPropsLazy } from "@webpack";
import { UserStore } from "@webpack/common";
import { Message } from "discord-types/general"; import { Message } from "discord-types/general";
import { classes, lazyWebpack, useAwaiter } from "../../../utils/misc";
import { Settings } from "../../../Vencord";
import { filters } from "../../../webpack";
import { UserStore } from "../../../webpack/common";
import { fetchPronouns, formatPronouns } from "../pronoundbUtils"; import { fetchPronouns, formatPronouns } from "../pronoundbUtils";
import { PronounMapping } from "../types"; import { PronounMapping } from "../types";
const styles: Record<string, string> = lazyWebpack(filters.byProps("timestampInline")); const styles: Record<string, string> = findByPropsLazy("timestampInline");
export default function PronounsChatComponentWrapper({ message }: { message: Message; }) { export default function PronounsChatComponentWrapper({ message }: { message: Message; }) {
// Don't bother fetching bot or system users // Don't bother fetching bot or system users

@ -16,9 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { useAwaiter } from "../../../utils/misc"; import { Settings } from "@api/settings";
import { Settings } from "../../../Vencord"; import { useAwaiter } from "@utils/misc";
import { UserStore } from "../../../webpack/common"; import { UserStore } from "@webpack/common";
import { fetchPronouns, formatPronouns } from "../pronoundbUtils"; import { fetchPronouns, formatPronouns } from "../pronoundbUtils";
import { PronounMapping, UserProfilePronounsProps, UserProfileProps } from "../types"; import { PronounMapping, UserProfilePronounsProps, UserProfileProps } from "../types";

@ -16,8 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "../../utils/types"; import definePlugin, { OptionType } from "@utils/types";
import PronounsAboutComponent from "./components/PronounsAboutComponent"; import PronounsAboutComponent from "./components/PronounsAboutComponent";
import PronounsChatComponent from "./components/PronounsChatComponent"; import PronounsChatComponent from "./components/PronounsChatComponent";
import PronounsProfileWrapper from "./components/PronounsProfileWrapper"; import PronounsProfileWrapper from "./components/PronounsProfileWrapper";

@ -16,9 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { VENCORD_USER_AGENT } from "../../utils/constants"; import { Settings } from "@api/settings";
import { debounce } from "../../utils/debounce"; import { VENCORD_USER_AGENT } from "@utils/constants";
import { Settings } from "../../Vencord"; import { debounce } from "@utils/debounce";
import { PronounsFormat } from "."; import { PronounsFormat } from ".";
import { PronounCode, PronounMapping, PronounsResponse } from "./types"; import { PronounCode, PronounMapping, PronounsResponse } from "./types";

@ -16,11 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import { lazyWebpack } from "../utils/misc"; import definePlugin from "@utils/types";
import definePlugin from "../utils/types"; import { findLazy } from "@webpack";
const ComponentDispatch = lazyWebpack(m => m.emitter?._events?.INSERT_TEXT); const ComponentDispatch = findLazy(m => m.emitter?._events?.INSERT_TEXT);
export default definePlugin({ export default definePlugin({
name: "QuickMention", name: "QuickMention",

@ -16,16 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { migratePluginSettings } from "@api/settings";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { findByPropsLazy } from "@webpack";
import { ChannelStore, FluxDispatcher as Dispatcher, MessageStore, SelectedChannelStore, UserStore } from "@webpack/common";
import { Message } from "discord-types/general"; import { Message } from "discord-types/general";
import { migratePluginSettings } from "../api/settings"; const Kangaroo = findByPropsLazy("jumpToMessage");
import { Devs } from "../utils/constants";
import { lazyWebpack } from "../utils/misc";
import definePlugin from "../utils/types";
import { filters } from "../webpack";
import { ChannelStore, FluxDispatcher as Dispatcher, MessageStore, SelectedChannelStore, UserStore } from "../webpack/common";
const Kangaroo = lazyWebpack(filters.byProps("jumpToMessage"));
const isMac = navigator.platform.includes("Mac"); // bruh const isMac = navigator.platform.includes("Mac"); // bruh
let replyIdx = -1; let replyIdx = -1;

@ -16,10 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { addServerListElement, removeServerListElement, ServerListRenderPosition } from "../api/ServerList"; import { addServerListElement, removeServerListElement, ServerListRenderPosition } from "@api/ServerList";
import { Devs } from "../utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "../utils/types"; import definePlugin from "@utils/types";
import { Button, FluxDispatcher, GuildChannelStore, GuildStore, React, ReadStateStore } from "../webpack/common"; import { Button, FluxDispatcher, GuildChannelStore, GuildStore, React, ReadStateStore } from "@webpack/common";
function onClick() { function onClick() {
const channels: Array<any> = []; const channels: Array<any> = [];

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save