Methods
(static) extend(structure, extender) → {function}
Extends a structure.
Make sure to extend all structures before instantiating your client.
Extending after doing so may not work as expected.
Parameters:
Name | Type | Description |
---|---|---|
structure |
ExtendableStructure | Name of the structure class to extend |
extender |
function | Function that takes the base class to extend as its only parameter and returns the extended class/prototype |
- Source:
Returns:
Extended class/prototype returned from the extender
- Type
- function
Example
const { Structures } = require('discord.js');
Structures.extend('Guild', Guild => {
class CoolGuild extends Guild {
constructor(client, data) {
super(client, data);
this.cool = true;
}
}
return CoolGuild;
});
(static) get(structure) → {function}
Retrieves a structure class.
Parameters:
Name | Type | Description |
---|---|---|
structure |
string | Name of the structure to retrieve |
- Source:
Returns:
- Type
- function