2022-10-18 22:04:55 +00:00
|
|
|
import * as _spitroast from "spitroast";
|
2022-10-22 17:59:01 +00:00
|
|
|
import _React from "react";
|
2023-01-14 16:24:14 +00:00
|
|
|
import _RN from "react-native";
|
2023-02-04 18:44:33 +00:00
|
|
|
import _Clipboard from "@react-native-clipboard/clipboard";
|
2023-02-14 18:33:42 +00:00
|
|
|
import _moment from "moment";
|
2023-03-22 21:02:53 +00:00
|
|
|
import _chroma from "chroma-js";
|
2023-03-22 21:24:55 +00:00
|
|
|
import _lodash from "lodash";
|
2022-10-18 22:04:55 +00:00
|
|
|
|
|
|
|
type MetroModules = { [id: number]: any };
|
|
|
|
|
2023-02-13 20:34:58 +00:00
|
|
|
// Component types
|
|
|
|
interface SummaryProps {
|
|
|
|
label: string;
|
|
|
|
icon?: string;
|
|
|
|
noPadding?: boolean;
|
2023-03-04 22:33:00 +00:00
|
|
|
noAnimation?: boolean;
|
2023-02-13 20:34:58 +00:00
|
|
|
children: JSX.Element | JSX.Element[];
|
|
|
|
}
|
|
|
|
|
2023-02-26 02:20:01 +00:00
|
|
|
interface ErrorBoundaryProps {
|
2023-04-13 18:42:14 +00:00
|
|
|
children: JSX.Element | JSX.Element[];
|
|
|
|
}
|
|
|
|
|
|
|
|
interface CodeblockProps {
|
|
|
|
selectable?: boolean;
|
|
|
|
style?: _RN.TextStyle;
|
|
|
|
children?: string;
|
2023-02-26 02:20:01 +00:00
|
|
|
}
|
|
|
|
|
2023-04-15 01:05:35 +00:00
|
|
|
interface SearchProps {
|
|
|
|
onChangeText?: (v: string) => void;
|
|
|
|
placeholder?: string;
|
|
|
|
style?: _RN.TextStyle;
|
|
|
|
}
|
|
|
|
|
2022-10-18 22:04:55 +00:00
|
|
|
// Helper types for API functions
|
|
|
|
type PropIntellisense<P extends string | symbol> = Record<P, any> & Record<PropertyKey, any>;
|
|
|
|
type PropsFinder = <T extends string | symbol>(...props: T[]) => PropIntellisense<T>;
|
|
|
|
type PropsFinderAll = <T extends string | symbol>(...props: T[]) => PropIntellisense<T>[];
|
|
|
|
|
|
|
|
type LoggerFunction = (...messages: any[]) => void;
|
|
|
|
interface Logger {
|
2022-10-22 17:59:01 +00:00
|
|
|
log: LoggerFunction;
|
|
|
|
info: LoggerFunction;
|
|
|
|
warn: LoggerFunction;
|
|
|
|
error: LoggerFunction;
|
|
|
|
time: LoggerFunction;
|
|
|
|
trace: LoggerFunction;
|
|
|
|
verbose: LoggerFunction;
|
2022-10-18 22:04:55 +00:00
|
|
|
}
|
|
|
|
|
2023-03-08 00:39:11 +00:00
|
|
|
type SearchTree = Record<string, any>;
|
|
|
|
type SearchFilter = (tree: SearchTree) => boolean;
|
2022-10-18 22:21:58 +00:00
|
|
|
interface FindInTreeOptions {
|
|
|
|
walkable?: string[];
|
|
|
|
ignore?: string[];
|
|
|
|
maxDepth?: number;
|
|
|
|
}
|
|
|
|
|
2022-10-22 22:26:06 +00:00
|
|
|
interface Asset {
|
|
|
|
name: string;
|
|
|
|
id: number;
|
|
|
|
}
|
|
|
|
|
2023-02-26 22:56:36 +00:00
|
|
|
export enum ButtonColors {
|
2023-02-26 21:26:01 +00:00
|
|
|
BRAND = "brand",
|
|
|
|
RED = "red",
|
|
|
|
GREEN = "green",
|
|
|
|
PRIMARY = "primary",
|
|
|
|
TRANSPARENT = "transparent",
|
|
|
|
GREY = "grey",
|
|
|
|
LIGHTGREY = "lightgrey",
|
|
|
|
WHITE = "white",
|
|
|
|
LINK = "link"
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ConfirmationAlertOptions {
|
2023-04-05 23:08:48 +00:00
|
|
|
title?: string;
|
2023-04-22 23:09:04 +00:00
|
|
|
content: string | JSX.Element | (string | JSX.Element)[];
|
2023-04-05 23:08:48 +00:00
|
|
|
confirmText?: string;
|
|
|
|
confirmColor?: ButtonColors;
|
2023-02-26 21:26:01 +00:00
|
|
|
onConfirm: () => void;
|
2023-04-22 23:09:04 +00:00
|
|
|
secondaryConfirmText?: string;
|
|
|
|
onConfirmSecondary?: () => void;
|
2023-04-05 23:08:48 +00:00
|
|
|
cancelText?: string;
|
2023-04-22 23:09:04 +00:00
|
|
|
isDismissable?: boolean;
|
2023-02-26 21:26:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface InputAlertProps {
|
2023-04-05 23:08:48 +00:00
|
|
|
title?: string;
|
|
|
|
confirmText?: string;
|
|
|
|
confirmColor?: ButtonColors;
|
|
|
|
onConfirm: (input: string) => (void | Promise<void>);
|
|
|
|
cancelText?: string;
|
|
|
|
placeholder?: string;
|
|
|
|
initialValue?: string;
|
2023-02-26 21:26:01 +00:00
|
|
|
}
|
|
|
|
|
2023-03-17 21:58:37 +00:00
|
|
|
interface Author {
|
2023-01-04 22:39:28 +00:00
|
|
|
name: string;
|
2023-03-17 21:58:37 +00:00
|
|
|
id?: string;
|
2023-01-04 22:39:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// See https://github.com/vendetta-mod/polymanifest
|
2023-01-03 00:18:19 +00:00
|
|
|
interface PluginManifest {
|
|
|
|
name: string;
|
|
|
|
description: string;
|
2023-03-17 21:58:37 +00:00
|
|
|
authors: Author[];
|
2023-01-04 22:39:28 +00:00
|
|
|
main: string;
|
|
|
|
hash: string;
|
|
|
|
// Vendor-specific field, contains our own data
|
2023-01-16 08:11:46 +00:00
|
|
|
vendetta?: {
|
|
|
|
icon?: string;
|
2023-01-04 22:39:28 +00:00
|
|
|
};
|
2023-01-03 00:18:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface Plugin {
|
|
|
|
id: string;
|
|
|
|
manifest: PluginManifest;
|
|
|
|
enabled: boolean;
|
2023-01-07 23:05:14 +00:00
|
|
|
update: boolean;
|
2023-01-03 00:18:19 +00:00
|
|
|
js: string;
|
|
|
|
}
|
|
|
|
|
2023-03-17 21:58:37 +00:00
|
|
|
interface ThemeData {
|
|
|
|
name: string;
|
|
|
|
description?: string;
|
|
|
|
authors?: Author[];
|
|
|
|
spec: number;
|
2023-04-15 16:08:08 +00:00
|
|
|
semanticColors?: Record<string, (string | false)[]>;
|
2023-04-15 02:04:48 +00:00
|
|
|
rawColors?: Record<string, string>;
|
2023-04-15 16:08:08 +00:00
|
|
|
background?: {
|
|
|
|
url: string;
|
|
|
|
blur?: number;
|
|
|
|
/**
|
|
|
|
* The alpha value of the background.
|
2023-05-30 18:03:49 +00:00
|
|
|
* `CHAT_BACKGROUND` of semanticColors alpha value will be ignored when this is specified
|
2023-04-15 16:08:08 +00:00
|
|
|
*/
|
|
|
|
alpha?: number;
|
|
|
|
}
|
2023-03-17 21:58:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface Theme {
|
|
|
|
id: string;
|
|
|
|
selected: boolean;
|
|
|
|
data: ThemeData;
|
|
|
|
}
|
|
|
|
|
2023-01-10 08:05:56 +00:00
|
|
|
interface Settings {
|
|
|
|
debuggerUrl: string;
|
|
|
|
developerSettings: boolean;
|
2023-04-13 18:42:14 +00:00
|
|
|
safeMode?: {
|
|
|
|
enabled: boolean;
|
|
|
|
currentThemeId?: string;
|
|
|
|
};
|
2023-01-10 08:05:56 +00:00
|
|
|
}
|
|
|
|
|
2023-01-30 00:40:56 +00:00
|
|
|
interface ApplicationCommand {
|
2023-01-25 08:28:48 +00:00
|
|
|
description: string;
|
|
|
|
name: string;
|
|
|
|
options: ApplicationCommandOption[];
|
|
|
|
execute: (args: any[], ctx: CommandContext) => CommandResult | void | Promise<CommandResult> | Promise<void>;
|
|
|
|
id?: string;
|
|
|
|
applicationId: string;
|
|
|
|
displayName: string;
|
|
|
|
displayDescription: string;
|
|
|
|
inputType: ApplicationCommandInputType;
|
|
|
|
type: ApplicationCommandType;
|
|
|
|
}
|
|
|
|
|
2023-02-26 22:56:36 +00:00
|
|
|
export enum ApplicationCommandInputType {
|
2023-01-25 08:28:48 +00:00
|
|
|
BUILT_IN,
|
|
|
|
BUILT_IN_TEXT,
|
|
|
|
BUILT_IN_INTEGRATION,
|
|
|
|
BOT,
|
|
|
|
PLACEHOLDER,
|
|
|
|
}
|
|
|
|
|
2023-01-30 00:40:56 +00:00
|
|
|
interface ApplicationCommandOption {
|
2023-01-25 08:28:48 +00:00
|
|
|
name: string;
|
|
|
|
description: string;
|
|
|
|
required?: boolean;
|
|
|
|
type: ApplicationCommandOptionType;
|
|
|
|
displayName: string;
|
|
|
|
displayDescription: string;
|
|
|
|
}
|
|
|
|
|
2023-02-26 22:56:36 +00:00
|
|
|
export enum ApplicationCommandOptionType {
|
2023-01-25 08:28:48 +00:00
|
|
|
SUB_COMMAND = 1,
|
|
|
|
SUB_COMMAND_GROUP,
|
|
|
|
STRING,
|
|
|
|
INTEGER,
|
|
|
|
BOOLEAN,
|
|
|
|
USER,
|
|
|
|
CHANNEL,
|
|
|
|
ROLE,
|
|
|
|
MENTIONABLE,
|
|
|
|
NUMBER,
|
|
|
|
ATTACHMENT,
|
|
|
|
}
|
|
|
|
|
2023-02-26 22:56:36 +00:00
|
|
|
export enum ApplicationCommandType {
|
2023-01-25 08:28:48 +00:00
|
|
|
CHAT = 1,
|
|
|
|
USER,
|
|
|
|
MESSAGE,
|
|
|
|
}
|
|
|
|
|
2023-01-30 00:40:56 +00:00
|
|
|
interface CommandContext {
|
2023-01-25 08:28:48 +00:00
|
|
|
channel: any;
|
|
|
|
guild: any;
|
|
|
|
}
|
|
|
|
|
2023-01-30 00:40:56 +00:00
|
|
|
interface CommandResult {
|
2023-01-25 08:28:48 +00:00
|
|
|
content: string;
|
|
|
|
tts?: boolean;
|
|
|
|
}
|
|
|
|
|
2023-01-14 16:24:14 +00:00
|
|
|
interface RNConstants extends _RN.PlatformConstants {
|
2023-01-14 16:05:08 +00:00
|
|
|
// Android
|
|
|
|
Version: number;
|
|
|
|
Release: string;
|
|
|
|
Serial: string;
|
|
|
|
Fingerprint: string;
|
|
|
|
Model: string;
|
|
|
|
Brand: string;
|
|
|
|
Manufacturer: string;
|
|
|
|
ServerHost?: string;
|
|
|
|
|
|
|
|
// iOS
|
|
|
|
forceTouchAvailable: boolean;
|
|
|
|
interfaceIdiom: string;
|
|
|
|
osVersion: string;
|
|
|
|
systemName: string;
|
|
|
|
}
|
|
|
|
|
2023-01-16 23:52:20 +00:00
|
|
|
/**
|
|
|
|
* A key-value storage based upon `SharedPreferences` on Android.
|
|
|
|
*
|
|
|
|
* These types are based on Android though everything should be the same between
|
|
|
|
* platforms.
|
|
|
|
*/
|
|
|
|
interface MMKVManager {
|
|
|
|
/**
|
|
|
|
* Get the value for the given `key`, or null
|
|
|
|
* @param key The key to fetch
|
|
|
|
*/
|
|
|
|
getItem: (key: string) => Promise<string | null>;
|
|
|
|
/**
|
|
|
|
* Deletes the value for the given `key`
|
|
|
|
* @param key The key to delete
|
|
|
|
*/
|
|
|
|
removeItem: (key: string) => void;
|
|
|
|
/**
|
|
|
|
* Sets the value of `key` to `value`
|
|
|
|
*/
|
|
|
|
setItem: (key: string, value: string) => void;
|
|
|
|
/**
|
|
|
|
* Goes through every item in storage and returns it, excluding the
|
|
|
|
* keys specified in `exclude`.
|
|
|
|
* @param exclude A list of items to exclude from result
|
|
|
|
*/
|
|
|
|
refresh: (exclude: string[]) => Promise<Record<string, string>>;
|
|
|
|
/**
|
|
|
|
* You will be murdered if you use this function.
|
|
|
|
* Clears ALL of Discord's settings.
|
|
|
|
*/
|
|
|
|
clear: () => void;
|
|
|
|
}
|
|
|
|
|
2023-04-05 19:40:17 +00:00
|
|
|
interface FileManager {
|
2023-02-06 07:48:55 +00:00
|
|
|
/**
|
|
|
|
* @param path **Full** path to file
|
|
|
|
*/
|
|
|
|
fileExists: (path: string) => Promise<boolean>;
|
|
|
|
/**
|
|
|
|
* Allowed URI schemes on Android: `file://`, `content://` ([See here](https://developer.android.com/reference/android/content/ContentResolver#accepts-the-following-uri-schemes:_3))
|
|
|
|
*/
|
|
|
|
getSize: (uri: string) => Promise<boolean>;
|
|
|
|
/**
|
|
|
|
* @param path **Full** path to file
|
|
|
|
* @param encoding Set to `base64` in order to encode response
|
|
|
|
*/
|
|
|
|
readFile(path: string, encoding: "base64" | "utf8"): Promise<string>;
|
2023-04-08 18:10:46 +00:00
|
|
|
saveFileToGallery?(uri: string, fileName: string, fileType: "PNG" | "JPEG"): Promise<string>;
|
2023-02-06 07:48:55 +00:00
|
|
|
/**
|
2023-02-09 21:48:43 +00:00
|
|
|
* Beware! This function has differing functionality on iOS and Android.
|
2023-02-06 07:48:55 +00:00
|
|
|
* @param storageDir Either `cache` or `documents`.
|
|
|
|
* @param path Path in `storageDir`, parents are recursively created.
|
|
|
|
* @param data The data to write to the file
|
|
|
|
* @param encoding Set to `base64` if `data` is base64 encoded.
|
|
|
|
* @returns Promise that resolves to path of the file once it got written
|
|
|
|
*/
|
|
|
|
writeFile(storageDir: "cache" | "documents", path: string, data: string, encoding: "base64" | "utf8"): Promise<string>;
|
|
|
|
getConstants: () => {
|
|
|
|
/**
|
|
|
|
* The path the `documents` storage dir (see {@link writeFile}) represents.
|
|
|
|
*/
|
|
|
|
DocumentsDirPath: string;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* Will apparently cease to exist some time in the future so please use {@link getConstants} instead.
|
|
|
|
* @deprecated
|
|
|
|
*/
|
|
|
|
DocumentsDirPath: string;
|
|
|
|
}
|
|
|
|
|
2023-01-30 14:15:44 +00:00
|
|
|
type EmitterEvent = "SET" | "GET" | "DEL";
|
2023-01-29 21:05:47 +00:00
|
|
|
|
|
|
|
interface EmitterListenerData {
|
2023-02-26 21:26:01 +00:00
|
|
|
path: string[];
|
|
|
|
value?: any;
|
2023-01-29 21:05:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type EmitterListener = (
|
2023-02-26 21:26:01 +00:00
|
|
|
event: EmitterEvent,
|
|
|
|
data: EmitterListenerData | any
|
2023-01-29 21:05:47 +00:00
|
|
|
) => any;
|
|
|
|
|
2023-04-15 02:04:48 +00:00
|
|
|
type EmitterListeners = Record<string, Set<EmitterListener>>
|
2023-01-29 21:05:47 +00:00
|
|
|
|
|
|
|
interface Emitter {
|
|
|
|
listeners: EmitterListeners;
|
|
|
|
on: (event: EmitterEvent, listener: EmitterListener) => void;
|
|
|
|
off: (event: EmitterEvent, listener: EmitterListener) => void;
|
|
|
|
once: (event: EmitterEvent, listener: EmitterListener) => void;
|
|
|
|
emit: (event: EmitterEvent, data: EmitterListenerData) => void;
|
|
|
|
}
|
|
|
|
|
2023-02-06 07:48:55 +00:00
|
|
|
interface StorageBackend {
|
|
|
|
get: () => unknown | Promise<unknown>;
|
|
|
|
set: (data: unknown) => void | Promise<void>;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LoaderConfig {
|
|
|
|
customLoadUrl: {
|
|
|
|
enabled: boolean;
|
|
|
|
url: string;
|
|
|
|
};
|
|
|
|
loadReactDevTools: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LoaderIdentity {
|
|
|
|
name: string;
|
|
|
|
features: {
|
|
|
|
loaderConfig?: boolean;
|
|
|
|
devtools?: {
|
|
|
|
prop: string;
|
|
|
|
version: string;
|
2023-03-17 21:58:37 +00:00
|
|
|
},
|
|
|
|
themes?: {
|
|
|
|
prop: string;
|
2023-02-06 07:48:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-04 18:33:31 +00:00
|
|
|
interface DiscordStyleSheet {
|
2023-04-15 15:25:03 +00:00
|
|
|
[index: string]: any,
|
2023-04-06 23:06:05 +00:00
|
|
|
createThemedStyleSheet: typeof import("react-native").StyleSheet.create;
|
2023-04-04 18:33:31 +00:00
|
|
|
}
|
|
|
|
|
2022-10-18 22:04:55 +00:00
|
|
|
interface VendettaObject {
|
|
|
|
patcher: {
|
|
|
|
after: typeof _spitroast.after;
|
|
|
|
before: typeof _spitroast.before;
|
|
|
|
instead: typeof _spitroast.instead;
|
2022-10-22 17:59:01 +00:00
|
|
|
};
|
2022-10-18 22:04:55 +00:00
|
|
|
metro: {
|
2023-02-22 00:25:14 +00:00
|
|
|
find: (filter: (m: any) => boolean) => any;
|
|
|
|
findAll: (filter: (m: any) => boolean) => any[];
|
2022-10-18 22:04:55 +00:00
|
|
|
findByProps: PropsFinder;
|
|
|
|
findByPropsAll: PropsFinderAll;
|
2023-03-20 08:09:25 +00:00
|
|
|
findByName: (name: string, defaultExp?: boolean) => any;
|
|
|
|
findByNameAll: (name: string, defaultExp?: boolean) => any[];
|
|
|
|
findByDisplayName: (displayName: string, defaultExp?: boolean) => any;
|
|
|
|
findByDisplayNameAll: (displayName: string, defaultExp?: boolean) => any[];
|
2023-04-04 18:45:53 +00:00
|
|
|
findByTypeName: (typeName: string, defaultExp?: boolean) => any;
|
|
|
|
findByTypeNameAll: (typeName: string, defaultExp?: boolean) => any[];
|
2023-02-14 18:28:27 +00:00
|
|
|
findByStoreName: (name: string) => any;
|
2022-10-22 17:59:01 +00:00
|
|
|
common: {
|
2023-05-29 22:07:31 +00:00
|
|
|
constants: PropIntellisense<"Fonts" | "Permissions">;
|
2022-10-28 17:50:40 +00:00
|
|
|
channels: PropIntellisense<"getVoiceChannelId">;
|
|
|
|
i18n: PropIntellisense<"Messages">;
|
|
|
|
url: PropIntellisense<"openURL">;
|
|
|
|
toasts: PropIntellisense<"open" | "close">;
|
2023-04-04 18:33:31 +00:00
|
|
|
stylesheet: DiscordStyleSheet;
|
2023-02-04 18:44:33 +00:00
|
|
|
clipboard: typeof _Clipboard;
|
2023-02-04 02:29:45 +00:00
|
|
|
assets: PropIntellisense<"registerAsset">;
|
|
|
|
invites: PropIntellisense<"acceptInviteAndTransitionToInviteChannel">;
|
2023-02-04 17:11:50 +00:00
|
|
|
commands: PropIntellisense<"getBuiltInCommands">;
|
2023-02-04 02:29:45 +00:00
|
|
|
navigation: PropIntellisense<"pushLazy">;
|
|
|
|
navigationStack: PropIntellisense<"createStackNavigator">;
|
|
|
|
NavigationNative: PropIntellisense<"NavigationContainer">;
|
2023-02-09 21:48:43 +00:00
|
|
|
// You may ask: "Why not just install Flux's types?"
|
|
|
|
// Answer: Discord have a (presumably proprietary) fork. It's wildly different.
|
|
|
|
Flux: PropIntellisense<"connectStores">;
|
|
|
|
FluxDispatcher: PropIntellisense<"_currentDispatchActionType">;
|
2022-10-22 17:59:01 +00:00
|
|
|
React: typeof _React;
|
|
|
|
ReactNative: typeof _RN;
|
2023-02-14 18:33:42 +00:00
|
|
|
moment: typeof _moment;
|
2023-03-22 21:02:53 +00:00
|
|
|
chroma: typeof _chroma;
|
2023-03-22 21:24:55 +00:00
|
|
|
lodash: typeof _lodash;
|
2022-10-22 17:59:01 +00:00
|
|
|
};
|
|
|
|
};
|
2022-10-28 17:50:40 +00:00
|
|
|
constants: {
|
|
|
|
DISCORD_SERVER: string;
|
2023-04-04 00:35:59 +00:00
|
|
|
DISCORD_SERVER_ID: string;
|
|
|
|
PLUGINS_CHANNEL_ID: string;
|
|
|
|
THEMES_CHANNEL_ID: string;
|
2022-10-28 17:50:40 +00:00
|
|
|
GITHUB: string;
|
2023-04-04 00:35:59 +00:00
|
|
|
PROXY_PREFIX: string;
|
2023-02-26 21:26:01 +00:00
|
|
|
HTTP_REGEX: RegExp;
|
2023-04-04 00:35:59 +00:00
|
|
|
HTTP_REGEX_MULTI: RegExp;
|
2022-10-28 17:50:40 +00:00
|
|
|
};
|
|
|
|
utils: {
|
2023-03-08 00:39:11 +00:00
|
|
|
findInReactTree: (tree: SearchTree, filter: SearchFilter) => any;
|
|
|
|
findInTree: (tree: SearchTree, filter: SearchFilter, options: FindInTreeOptions) => any;
|
2023-04-15 15:25:03 +00:00
|
|
|
safeFetch: (input: RequestInfo | URL, options?: RequestInit, timeout?: number) => Promise<Response>;
|
2023-02-04 02:37:36 +00:00
|
|
|
unfreeze: (obj: object) => object;
|
2023-04-09 18:53:26 +00:00
|
|
|
without: <O extends object, K extends readonly (keyof O)[]>(object: O, ...keys: K) => Omit<O, typeof keys[number]>;
|
2022-10-28 17:50:40 +00:00
|
|
|
};
|
|
|
|
debug: {
|
|
|
|
connectToDebugger: (url: string) => void;
|
2023-02-04 02:29:45 +00:00
|
|
|
// TODO: Type output?
|
|
|
|
getDebugInfo: () => void;
|
2022-10-28 17:50:40 +00:00
|
|
|
}
|
2022-10-22 22:26:06 +00:00
|
|
|
ui: {
|
2022-10-28 17:50:40 +00:00
|
|
|
components: {
|
2023-02-13 20:34:58 +00:00
|
|
|
// Discord
|
2023-01-05 23:07:58 +00:00
|
|
|
Forms: PropIntellisense<"Form" | "FormSection">;
|
|
|
|
General: PropIntellisense<"Button" | "Text" | "View">;
|
2023-02-26 21:26:01 +00:00
|
|
|
Alert: _React.ComponentType;
|
2023-04-13 18:42:14 +00:00
|
|
|
Button: _React.ComponentType<any> & { Looks: any, Colors: ButtonColors, Sizes: any };
|
2023-04-14 23:49:59 +00:00
|
|
|
HelpMessage: _React.ComponentType;
|
|
|
|
SafeAreaView: typeof _RN.SafeAreaView;
|
2023-02-13 20:34:58 +00:00
|
|
|
// Vendetta
|
2023-02-26 22:24:38 +00:00
|
|
|
Summary: _React.ComponentType<SummaryProps>;
|
|
|
|
ErrorBoundary: _React.ComponentType<ErrorBoundaryProps>;
|
2023-04-13 18:42:14 +00:00
|
|
|
Codeblock: _React.ComponentType<CodeblockProps>;
|
2023-04-15 01:05:35 +00:00
|
|
|
Search: _React.ComponentType<SearchProps>;
|
2022-10-28 17:50:40 +00:00
|
|
|
}
|
|
|
|
toasts: {
|
2023-04-15 18:54:23 +00:00
|
|
|
showToast: (content: string, asset?: number) => void;
|
2022-10-28 17:50:40 +00:00
|
|
|
};
|
2023-02-26 21:26:01 +00:00
|
|
|
alerts: {
|
|
|
|
showConfirmationAlert: (options: ConfirmationAlertOptions) => void;
|
|
|
|
showCustomAlert: (component: _React.ComponentType, props: any) => void;
|
|
|
|
showInputAlert: (options: InputAlertProps) => void;
|
|
|
|
};
|
2022-10-22 22:26:06 +00:00
|
|
|
assets: {
|
2023-04-15 02:04:48 +00:00
|
|
|
all: Record<string, Asset>;
|
2022-10-22 22:26:06 +00:00
|
|
|
find: (filter: (a: any) => void) => Asset | null | undefined;
|
|
|
|
getAssetByName: (name: string) => Asset;
|
2022-10-22 23:05:04 +00:00
|
|
|
getAssetByID: (id: number) => Asset;
|
2022-10-22 22:26:06 +00:00
|
|
|
getAssetIDByName: (name: string) => number;
|
2022-10-28 17:50:40 +00:00
|
|
|
};
|
2023-02-21 17:59:29 +00:00
|
|
|
// TODO: Make a vain attempt to type these
|
2023-04-15 02:04:48 +00:00
|
|
|
semanticColors: Record<string, any>;
|
|
|
|
rawColors: Record<string, any>;
|
2022-10-22 22:26:06 +00:00
|
|
|
};
|
2023-01-08 23:24:00 +00:00
|
|
|
plugins: {
|
2023-04-15 02:04:48 +00:00
|
|
|
plugins: Record<string, Plugin>;
|
2023-04-05 20:18:22 +00:00
|
|
|
fetchPlugin: (id: string) => Promise<void>;
|
|
|
|
installPlugin: (id: string, enabled?: boolean) => Promise<void>;
|
|
|
|
startPlugin: (id: string) => Promise<void>;
|
2023-03-20 21:30:13 +00:00
|
|
|
stopPlugin: (id: string, disable?: boolean) => void;
|
2023-01-08 23:24:00 +00:00
|
|
|
removePlugin: (id: string) => void;
|
|
|
|
getSettings: (id: string) => JSX.Element;
|
2023-01-25 08:28:48 +00:00
|
|
|
};
|
2023-03-17 21:58:37 +00:00
|
|
|
themes: {
|
2023-04-15 02:04:48 +00:00
|
|
|
themes: Record<string, Theme>;
|
2023-04-05 20:18:22 +00:00
|
|
|
fetchTheme: (id: string, selected?: boolean) => Promise<void>;
|
|
|
|
installTheme: (id: string) => Promise<void>;
|
|
|
|
selectTheme: (id: string) => Promise<void>;
|
2023-03-20 21:30:13 +00:00
|
|
|
removeTheme: (id: string) => Promise<boolean>;
|
|
|
|
getCurrentTheme: () => Theme | null;
|
2023-04-05 20:18:22 +00:00
|
|
|
updateThemes: () => Promise<void>;
|
2023-03-17 21:58:37 +00:00
|
|
|
};
|
2023-01-25 08:28:48 +00:00
|
|
|
commands: {
|
|
|
|
registerCommand: (command: ApplicationCommand) => () => void;
|
|
|
|
};
|
2023-01-29 21:05:47 +00:00
|
|
|
storage: {
|
2023-01-30 15:33:33 +00:00
|
|
|
createProxy: <T>(target: T) => { proxy: T, emitter: Emitter };
|
|
|
|
useProxy: <T>(storage: T) => T;
|
2023-02-06 07:48:55 +00:00
|
|
|
createStorage: <T>(backend: StorageBackend) => Promise<Awaited<T>>;
|
2023-01-30 15:33:33 +00:00
|
|
|
wrapSync: <T extends Promise<any>>(store: T) => Awaited<T>;
|
|
|
|
awaitSyncWrapper: (store: any) => Promise<void>;
|
2023-02-06 07:48:55 +00:00
|
|
|
createMMKVBackend: (store: string) => StorageBackend;
|
|
|
|
createFileBackend: (file: string) => StorageBackend;
|
2023-01-29 21:05:47 +00:00
|
|
|
};
|
2023-01-10 22:05:40 +00:00
|
|
|
settings: Settings;
|
2023-02-06 07:48:55 +00:00
|
|
|
loader: {
|
|
|
|
identity?: LoaderIdentity;
|
|
|
|
config: LoaderConfig;
|
|
|
|
};
|
2022-10-18 22:04:55 +00:00
|
|
|
logger: Logger;
|
2023-01-10 23:30:46 +00:00
|
|
|
version: string;
|
2023-02-04 02:29:45 +00:00
|
|
|
unload: () => void;
|
2022-10-18 22:04:55 +00:00
|
|
|
}
|
|
|
|
|
2023-01-30 21:34:14 +00:00
|
|
|
interface VendettaPluginObject {
|
2023-02-20 18:47:30 +00:00
|
|
|
id: string;
|
2023-02-14 18:35:48 +00:00
|
|
|
manifest: PluginManifest;
|
2023-04-15 02:04:48 +00:00
|
|
|
storage: Record<string, any>;
|
2023-01-30 21:34:14 +00:00
|
|
|
}
|
|
|
|
|
2022-10-18 22:04:55 +00:00
|
|
|
declare global {
|
2023-01-03 00:18:19 +00:00
|
|
|
type React = typeof _React;
|
2023-05-30 18:03:49 +00:00
|
|
|
const __vendettaVersion: string;
|
|
|
|
|
2022-10-18 22:04:55 +00:00
|
|
|
interface Window {
|
|
|
|
[key: PropertyKey]: any;
|
|
|
|
modules: MetroModules;
|
|
|
|
vendetta: VendettaObject;
|
2023-01-03 00:18:19 +00:00
|
|
|
React: typeof _React;
|
2023-02-06 07:48:55 +00:00
|
|
|
__vendetta_loader?: LoaderIdentity;
|
2022-10-18 22:04:55 +00:00
|
|
|
}
|
2022-10-22 17:59:01 +00:00
|
|
|
}
|