Description

Random set of utilities that didn't fit elsewhere.

Classes


new Filters()

Members


<static> require

Description

Discord's webpack_require function.

Methods


<static> getModule( filter, first ) → {Any}

Description

Finds a module using a filter function.

Parameters
Name Type Default Description
filter function

A function to use to filter modules

first Boolean true

Whether to return only the first matching module

Returns

<static> getIndex( filter ) → {Number|null}

Description

Gets the index in the webpack require cache of a specific module using a filter.

Parameters
Name Type Description
filter function

A function to use to filter modules

Returns

<static> getIndexByModule( module ) → {Number|null}

Description

Gets the index in the webpack require cache of a specific module that was already found.

Parameters
Name Type Description
module Any

An already acquired module

Returns

<static> getModules( filter )

Description

Finds all modules matching a filter function.

Parameters
Name Type Description
filter function

A function to use to filter modules


<static> getModuleByName( name, fallback ) → {Any}

Description

Finds a module by its name.

Parameters
Name Type Description
name String

The name of the module

fallback function

A function to use to filter modules if not finding a known module

Returns

<static> getByDisplayName( name ) → {Any}

Description

Finds a module by its display name.

Parameters
Name Type Description
name String

The display name of the module

Returns

<static> getByRegex( regex, first ) → {Any}

Description

Finds a module using its code.

Parameters
Name Type Default Description
regex RegEx

A regular expression to use to filter modules

first Boolean true

Whether to return the only the first matching module

Returns

<static> getByPrototypes( ...prototypes ) → {Any}

Description

Finds a single module using properties on its prototype.

Parameters
Name Type Attributes Description
prototypes string <repeatable>

Properties to use to filter modules

Returns

<static> getAllByPrototypes( ...prototypes ) → {Any}

Description

Finds all modules with a set of properties of its prototype.

Parameters
Name Type Attributes Description
prototypes string <repeatable>

Properties to use to filter modules

Returns

<static> getByProps( ...props ) → {Any}

Description

Finds a single module using its own properties.

Parameters
Name Type Attributes Description
props string <repeatable>

Properties to use to filter modules

Returns

<static> getAllByProps( ...props ) → {Any}

Description

Finds all modules with a set of properties.

Parameters
Name Type Attributes Description
props string <repeatable>

Properties to use to filter modules

Returns

<static> getByString( ...props ) → {Any}

Description

Finds a single module using a set of strings.

Parameters
Name Type Attributes Description
props String <repeatable>

Strings to use to filter modules

Returns

<static> getAllByString( ...strings ) → {Any}

Description

Finds all modules with a set of strings.

Parameters
Name Type Attributes Description
strings String <repeatable>

Strings to use to filter modules

Returns

<static> getByIndex( index ) → {Any}

Description

Gets a specific module by index of the webpack require cache. Best used in combination with getIndex in order to patch a specific function.

Note: this gives the raw module, meaning the actual module is in returnValue.exports. This is done in order to be able to patch modules which export a single function directly.

Parameters
Name Type Description
index Number

Index into the webpack require cache

Returns

<static> getAllModules() → {Array}

Description

Returns all loaded modules.

Returns

<static> addListener( listener ) → {function}

Description

Adds a listener for when discord loaded a chunk. Useful for subscribing to lazy loaded modules.

Parameters
Name Type Description
listener function

Function to subscribe for chunks

Returns

A cancelling function


<static> removeListener( listener ) → {boolean}

Description

Removes a listener for when discord loaded a chunk.

Parameters
Name Type Description
listener function
Returns