Description

A series of useful functions for BetterDiscord plugins.

Details

1/21/22 Use Alternatives

Methods


<static> loadData( name, key, defaultData ) → {object}

Description

Loads data through BetterDiscord's API.

Parameters
Name Type Description
name string

name for the file (usually plugin name)

key string

which key the data is saved under

defaultData object

default data to populate the object with

Returns

the combined saved and default data

Details

1/21/22 Use Utilities or BdApi directly


<static> saveData( name, key, data )

Description

Saves data through BetterDiscord's API.

Parameters
Name Type Description
name string

name for the file (usually plugin name)

key string

which key the data should be saved under

data object

data to save

Details

1/21/22 Use Utilities or BdApi directly


<static> loadSettings( name, defaultData ) → {object}

Description

Loads settings through BetterDiscord's API.

Parameters
Name Type Description
name string

name for the file (usually plugin name)

defaultData object

default data to populate the object with

Returns

the combined saved and default settings

Details

1/21/22 Use Utilities or BdApi directly


<static> saveSettings( name, data )

Description

Saves settings through BetterDiscord's API.

Parameters
Name Type Description
name string

name for the file (usually plugin name)

data object

settings to save

Details

1/21/22 Use Utilities or BdApi directly


<static> getBDFolder() → {string}

Description

Get the full path to the BetterDiscord folder.

Returns

full path to the BetterDiscord folder

Details

1/21/22 Use BdApi


<static> getPluginsFolder() → {string}

Description

Get the full path to the plugins folder.

Returns

full path to the plugins folder

Details

1/21/22 Use BdApi


<static> getThemesFolder() → {string}

Description

Get the full path to the themes folder.

Returns

full path to the themes folder

Details

1/21/22 Use BdApi


<static> addOnSwitchListener( callback )

Description

Adds a callback to a set of listeners for onSwitch.

Parameters
Name Type Description
callback callable

basic callback to happen on channel switch

Details

1/21/22 Use onSwitch


<static> removeOnSwitchListener( callback )

Description

Removes the listener added by InternalUtilities.addOnSwitchListener.

Parameters
Name Type Description
callback callable

callback to remove from the listener list

Details

1/21/22 Use onSwitch


<static> addStyle( id, css )

Description

Adds a style to the document.

Parameters
Name Type Description
id string

identifier to use as the element id

css string

css to add to the document

Details

1/21/22 Use DOMTools


<static> removeStyle( id )

Description

Removes a style from the document.

Parameters
Name Type Description
id string

original identifier used

Details

1/21/22 Use DOMTools


<static> addScript( id, url ) → {Promise}

Description

Adds/requires a remote script to be loaded

Parameters
Name Type Description
id string

identifier to use for this script

url string

url from which to load the script

Returns

promise that resolves when the script is loaded

Details

1/21/22 Use DOMTools


<static> removeScript( id )

Description

Removes a remote script from the document.

Parameters
Name Type Description
id string

original identifier used

Details

1/21/22 Use DOMTools