2020-07-15 01:50:02 +02:00
|
|
|
import WebpackLoader from "./modules/WebpackLoader"
|
|
|
|
import Components from "./components/components"
|
|
|
|
import uuid from "./modules/uuid"
|
|
|
|
import Utils from "./modules/Utils"
|
|
|
|
import DiscordTools from "./modules/DiscordTools"
|
|
|
|
import * as patchers from "./modules/patchers"
|
2020-07-17 14:54:49 +02:00
|
|
|
import excludeProperties from "./modules/excludeProperties"
|
|
|
|
import cloneNullProto from "./modules/cloneNullProto"
|
|
|
|
import NOOP from "./modules/noop"
|
|
|
|
import unfreeze from "./modules/Unfreeze"
|
2020-07-28 03:02:29 +02:00
|
|
|
import { isNative, isImported } from "./modules/environnement"
|
|
|
|
import * as bandagedbdApi from "@bandagedbd/bdapi"
|
2020-07-15 01:50:02 +02:00
|
|
|
patchers.patch()
|
|
|
|
|
|
|
|
const LightcordApi = {
|
|
|
|
WebpackLoader: WebpackLoader,
|
|
|
|
Components: Components,
|
|
|
|
uuid: uuid,
|
|
|
|
Utils: Utils,
|
2020-07-17 14:54:49 +02:00
|
|
|
DiscordTools: DiscordTools,
|
|
|
|
_: {
|
|
|
|
excludeProperties: excludeProperties,
|
|
|
|
cloneNullProto: cloneNullProto,
|
|
|
|
NOOP: NOOP,
|
|
|
|
unfreeze: unfreeze
|
2020-07-28 03:02:29 +02:00
|
|
|
},
|
|
|
|
get isNative(){return isNative},
|
|
|
|
get isImported(){return isImported}
|
2020-07-15 01:50:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
declare global {
|
|
|
|
var React:typeof import("react")
|
|
|
|
interface Window {
|
2020-07-28 03:02:29 +02:00
|
|
|
/**
|
|
|
|
* Lightcord is only availlaible in Lightcord (native)
|
|
|
|
*/
|
2020-07-15 01:50:02 +02:00
|
|
|
Lightcord: LightcordGlobal,
|
2020-07-28 03:02:29 +02:00
|
|
|
/**
|
|
|
|
* BDModules is only availlaible in Lightcord (native)
|
|
|
|
*/
|
2020-07-15 01:50:02 +02:00
|
|
|
BDModules: {
|
|
|
|
modules:any[],
|
|
|
|
get(filter:(mod:any)=>boolean, modules?:any[]):any[],
|
|
|
|
get(id:number, modules?:any[]):any,
|
|
|
|
get(ids: [number|((mod:any)=>boolean)], modules?:any[]):any
|
2020-07-28 03:02:29 +02:00
|
|
|
},
|
|
|
|
BdApi: typeof bandagedbdApi.BdApi,
|
|
|
|
EDApi: typeof bandagedbdApi.BdApi
|
2020-07-15 01:50:02 +02:00
|
|
|
}
|
|
|
|
var Lightcord:LightcordGlobal
|
2020-07-28 04:32:51 +02:00
|
|
|
var BdApi: typeof bandagedbdApi.BdApi
|
|
|
|
var EDApi: typeof bandagedbdApi.BdApi
|
2020-07-15 01:50:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export default LightcordApi
|
|
|
|
|
|
|
|
Object.assign(window.Lightcord.Api, LightcordApi)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The main Lightcord exports. Can be accessed with `window.Lightcord`
|
|
|
|
*/
|
|
|
|
export interface LightcordGlobal {
|
|
|
|
DiscordModules: {
|
|
|
|
/**
|
|
|
|
* Internal Discord's dispatcher - can be used to subscribe to gateway events / client events.
|
|
|
|
*/
|
|
|
|
dispatcher: import("./types/DiscordDispatcherTypes").default,
|
|
|
|
constants: import("./types/DiscordConstantsTypes").default
|
|
|
|
},
|
|
|
|
Settings: {
|
|
|
|
devMode: boolean,
|
|
|
|
callRingingBeat: boolean
|
|
|
|
},
|
2020-07-17 14:54:49 +02:00
|
|
|
Api: LightcordApiGlobal,
|
|
|
|
BetterDiscord: {
|
2020-07-28 03:02:29 +02:00
|
|
|
BdApi: typeof bandagedbdApi.BdApi,
|
2020-07-17 14:54:49 +02:00
|
|
|
[mod:string]:any
|
|
|
|
}
|
2020-07-15 01:50:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The main Api. Can be accessed with `window.Lightcord.Api`
|
|
|
|
*/
|
|
|
|
type LightcordApiGlobal = lightcordApiMainExports & typeof LightcordApi
|
|
|
|
|
|
|
|
type lightcordApiMainExports = {
|
|
|
|
/**
|
|
|
|
* Waits until the first module that match the filter gets exported
|
|
|
|
* @param filter The filter that specifies the module to match.
|
|
|
|
*/
|
|
|
|
ensureExported(filter: (mod:any) => boolean):Promise<any>,
|
|
|
|
/**
|
|
|
|
* Recreate the object without the `__proto__` and `prototype` properties - usefull for better formatting in console.
|
|
|
|
* @param obj The object to recreate
|
|
|
|
*/
|
|
|
|
cloneNullProto<Obj = any>(obj:Obj):Obj
|
2020-07-04 22:42:26 +02:00
|
|
|
}
|