From cf07b7e3425d78a1abf971f6f8ddd026cfa449c1 Mon Sep 17 00:00:00 2001 From: Schuyler Cebulskie Date: Mon, 20 Nov 2017 01:13:36 -0500 Subject: [PATCH] Re-add docs --- src/util/Structures.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/util/Structures.js b/src/util/Structures.js index fd2e44584..90c6f23b2 100644 --- a/src/util/Structures.js +++ b/src/util/Structures.js @@ -1,5 +1,7 @@ /** * Allows for the extension of built-in Discord.js structures that are instantiated by {@link DataStore DataStores}. + * When extending a built-in structure, it is important to both get the class you're extending from here, + * and to set it here afterwards. */ class Structures { constructor() { @@ -20,6 +22,17 @@ class Structures { * Replaces a structure class with an extended one. * @param {string} structure Name of the structure to replace * @param {Function} extended Extended structure class/prototype function to replace with + * @example + * const { Structures } = require('discord.js'); + * + * class CoolGuild extends Structures.get('Guild') { + * constructor(client, data) { + * super(client, data); + * this.cool = true; + * } + * } + * + * Structures.set('Guild', CoolGuild); */ static set(structure, extended) { if (!structures[structure]) throw new RangeError(`"${structure}" is not a valid extensible structure.`);