Documentation Index
Fetch the complete documentation index at: https://mintlify.com/betterdiscord/betterdiscord/llms.txt
Use this file to discover all available pages before exploring further.
BdApi.Utils provides commonly reused utility functions for working with objects, trees, debouncing, HTML escaping, and more.
Methods
findInTree
Finds a value, subobject, or array from a tree that matches a specific filter using depth-first search.Tree that should be walked
Filter to check against each object and subobject. Should return
true when the desired value is found.Array of strings to use as keys that are allowed to be walked on.
null indicates all keys are walkable.Array of strings to use as keys to exclude from the search. Most helpful when
walkable is null.forceLoad
Loads the module ids within a webpack chunk.Module with the chunk id
Promise that resolves to the loaded chunk module.
extend
Deep extends an object with a set of other objects. Objects later in the list have priority.Object to be extended
Objects to extend with. Later objects have priority.
extendee.
debounce
Returns a debounced function that delays invoking the provided function until afterdelay milliseconds have elapsed since the last invocation.
The function to be debounced
Number of milliseconds to delay calls
escapeHTML
Takes a string of HTML and escapes it using the browser’s own escaping mechanism.HTML to be escaped
className
Builds a classname string from any number of arguments. Supports arrays and objects.Anything that should be used to add classnames. Arrays add all values, objects add keys where values are truthy.
getNestedValue
Gets a nested value (if it exists) of an object safely using a key path string.Object to get nested value from
Key path to the desired value (e.g.,
"key.key2.key3"). Numbers can be used for arrays like "key.array.0.id".semverCompare
Compares two semantic version strings (e.g., “1.0.0”).First version to compare
Second version to compare
0if versions are equal-1ifcurrentVersionis greater1ifnewVersionis greater