Skip to content

Class: Webpack

Defined in: src/betterdiscord/api/webpack.ts:30

Webpack is a utility class for getting internal webpack modules. Instance is accessible through the BdApi. This is extremely useful for interacting with the internals of Discord.

Properties

Filters

ts
static Filters: {
  byComponentType: ExportedOnlyFilter;
  byDisplayName: ExportedOnlyFilter;
  byKeys: ExportedOnlyFilter;
  byPrototypeKeys: ExportedOnlyFilter;
  byRegex: ExportedOnlyFilter;
  bySource: Filter;
  byStoreName: ExportedOnlyFilter;
  byStrings: ExportedOnlyFilter;
  combine: Filter;
  not: Filter;
};

Defined in: src/betterdiscord/api/webpack.ts:42

Series of Filters to be used for finding webpack modules.

byComponentType()

ts
byComponentType(filter: ExportedOnlyFilter): ExportedOnlyFilter;

Generates a filter to search React functional components.

Parameters
ParameterType
filterExportedOnlyFilter
Returns

ExportedOnlyFilter

byDisplayName()

ts
byDisplayName(name: string): ExportedOnlyFilter;

Generates a function that filters by the displayName property.

Parameters
ParameterType
namestring
Returns

ExportedOnlyFilter

byKeys()

ts
byKeys(...keys: string[]): ExportedOnlyFilter;

Generates a function that filters by a set of properties.

Parameters
ParameterType
...keysstring[]
Returns

ExportedOnlyFilter

byPrototypeKeys()

ts
byPrototypeKeys(...props: string[]): ExportedOnlyFilter;

Generates a function that filters by a set of properties on the object's prototype.

Parameters
ParameterType
...propsstring[]
Returns

ExportedOnlyFilter

byRegex()

ts
byRegex(regex: RegExp): ExportedOnlyFilter;

Generates a function that filters by a regex.

Parameters
ParameterType
regexRegExp
Returns

ExportedOnlyFilter

bySource()

ts
bySource(...searches: (
  | string
  | RegExp)[]): Filter;

Generates a function that filters by source code content.

Parameters
ParameterType
...searches( | string | RegExp)[]
Returns

Filter

byStoreName()

ts
byStoreName(name: string): ExportedOnlyFilter;

Generates a function that filters by a specific internal Store name.

Parameters
ParameterType
namestring
Returns

ExportedOnlyFilter

byStrings()

ts
byStrings(...strings: string[]): ExportedOnlyFilter;

Generates a function that filters by strings.

Parameters
ParameterType
...stringsstring[]
Returns

ExportedOnlyFilter

combine()

ts
combine(...filters: Filter[]): Filter;

Generates a combined function from a list of filters.

Parameters
ParameterType
...filtersFilter[]
Returns

Filter

not()

ts
not(filter: Filter): Filter;

Generates a filter that returns the opposite of the passed filter.

Parameters
ParameterType
filterFilter
Returns

Filter


modules

ts
static modules: Record<PropertyKey, RawModule>;

Defined in: src/betterdiscord/api/webpack.ts:34

A Proxy that returns the module source by ID.


Stores

ts
static Stores: Record<StoreNameType, FluxStore>;

Defined in: src/betterdiscord/api/webpack.ts:36

Methods

getAllByKeys()

ts
static getAllByKeys<T>(...props: WithOptions<string, WebpackOptions>): void | T;

Defined in: src/betterdiscord/api/webpack.ts:147

Type Parameters

Type Parameter
T extends any[]

Parameters

ParameterType
...propsWithOptions<string, WebpackOptions>

Returns

void | T


getAllByPrototypeKeys()

ts
static getAllByPrototypeKeys<T>(...prototypes: WithOptions<string, WebpackOptions>): void | T;

Defined in: src/betterdiscord/api/webpack.ts:136

Type Parameters

Type Parameter
T extends any[]

Parameters

ParameterType
...prototypesWithOptions<string, WebpackOptions>

Returns

void | T


getAllByRegex()

ts
static getAllByRegex<T>(regex: RegExp, options: WebpackOptions): void | T;

Defined in: src/betterdiscord/api/webpack.ts:119

Type Parameters

Type Parameter
T extends any[]

Parameters

ParameterType
regexRegExp
optionsWebpackOptions

Returns

void | T


getAllBySource()

ts
static getAllBySource<T>(...searches: WithOptions<
  | string
  | RegExp, WebpackOptions>): void | T;

Defined in: src/betterdiscord/api/webpack.ts:170

Type Parameters

Type Parameter
T extends object[]

Parameters

ParameterType
...searchesWithOptions< | string | RegExp, WebpackOptions>

Returns

void | T


getAllByStrings()

ts
static getAllByStrings<T>(...strings: WithOptions<string, WebpackOptions>): void | T;

Defined in: src/betterdiscord/api/webpack.ts:158

Type Parameters

Type Parameter
T extends any[]

Parameters

ParameterType
...stringsWithOptions<string, WebpackOptions>

Returns

void | T


getBulk()

ts
static getBulk<T>(...queries: BulkQueries[]): T;

Defined in: src/betterdiscord/api/webpack.ts:104

Type Parameters

Type Parameter
T extends any[]

Parameters

ParameterType
...queriesBulkQueries[]

Returns

T


getBulkKeyed()

ts
static getBulkKeyed<T>(queries: Record<keyof T, BulkQueries>): T;

Defined in: src/betterdiscord/api/webpack.ts:105

Type Parameters

Type Parameter
T extends object

Parameters

ParameterType
queriesRecord<keyof T, BulkQueries>

Returns

T


getById()

ts
static getById(id: PropertyKey): object | undefined;

Defined in: src/betterdiscord/api/webpack.ts:178

Parameters

ParameterType
idPropertyKey

Returns

object | undefined


getByKeys()

ts
static getByKeys<T>(...props: WithOptions<string, WebpackOptions>): void | T;

Defined in: src/betterdiscord/api/webpack.ts:142

Type Parameters

Type Parameter
T

Parameters

ParameterType
...propsWithOptions<string, WebpackOptions>

Returns

void | T


getByPrototypeKeys()

ts
static getByPrototypeKeys<T>(...prototypes: WithOptions<string, WebpackOptions>): void | T;

Defined in: src/betterdiscord/api/webpack.ts:131

Type Parameters

Type Parameter
T

Parameters

ParameterType
...prototypesWithOptions<string, WebpackOptions>

Returns

void | T


getByRegex()

ts
static getByRegex<T>(regex: RegExp, options: WebpackOptions): void | T;

Defined in: src/betterdiscord/api/webpack.ts:115

Type Parameters

Type Parameter
T

Parameters

ParameterType
regexRegExp
optionsWebpackOptions

Returns

void | T


getBySource()

ts
static getBySource<T>(...searches: WithOptions<
  | string
  | RegExp, WebpackOptions>): void | T;

Defined in: src/betterdiscord/api/webpack.ts:164

Type Parameters

Type Parameter
T

Parameters

ParameterType
...searchesWithOptions< | string | RegExp, WebpackOptions>

Returns

void | T


getByStrings()

ts
static getByStrings<T>(...strings: WithOptions<string, WebpackOptions>): void | T;

Defined in: src/betterdiscord/api/webpack.ts:153

Type Parameters

Type Parameter
T

Parameters

ParameterType
...stringsWithOptions<string, WebpackOptions>

Returns

void | T


getMangled()

ts
static getMangled<T>(
   filter: 
  | string
  | RegExp
  | Filter, 
   mangled: Record<keyof T, ExportedOnlyFilter>, 
   options: Options): void | T;

Defined in: src/betterdiscord/api/webpack.ts:123

Type Parameters

Type Parameter
T extends object

Parameters

ParameterType
filter| string | RegExp | Filter
mangledRecord<keyof T, ExportedOnlyFilter>
optionsOptions

Returns

void | T


getModule()

ts
static getModule<T>(filter: Filter, options: WebpackOptions): void | T;

Defined in: src/betterdiscord/api/webpack.ts:87

Type Parameters

Type Parameter
T extends unknown

Parameters

ParameterType
filterFilter
optionsWebpackOptions

Returns

void | T


getModules()

ts
static getModules<T>(filter: Filter, options: WebpackOptions): void | T;

Defined in: src/betterdiscord/api/webpack.ts:97

Type Parameters

Type Parameter
T extends any[]

Parameters

ParameterType
filterFilter
optionsWebpackOptions

Returns

void | T


getStore()

ts
static getStore(name: string): FluxStore | undefined;

Defined in: src/betterdiscord/api/webpack.ts:176

Parameters

ParameterType
namestring

Returns

FluxStore | undefined


getWithKey()

ts
static getWithKey(filter: ExportedOnlyFilter, options: WithKeyOptions): 
  | void
| Generator<any, void, unknown>;

Defined in: src/betterdiscord/api/webpack.ts:79

Parameters

ParameterType
filterExportedOnlyFilter
optionsWithKeyOptions

Returns

| void | Generator<any, void, unknown>


waitForModule()

ts
static waitForModule<T>(filter: Filter, options: LazyOptions): 
  | void
| Promise<T | undefined>;

Defined in: src/betterdiscord/api/webpack.ts:107

Type Parameters

Type Parameter
T

Parameters

ParameterType
filterFilter
optionsLazyOptions

Returns

| void | Promise<T | undefined>