From ca271b7590761587deff1543e972466a2e82310a Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Thu, 13 Jan 2022 21:51:21 +0200 Subject: [PATCH] usage embed --- src/structure/interfaces/Setting.js | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/structure/interfaces/Setting.js b/src/structure/interfaces/Setting.js index fc50fa8..b85b206 100644 --- a/src/structure/interfaces/Setting.js +++ b/src/structure/interfaces/Setting.js @@ -65,6 +65,8 @@ class Setting extends Component { this.default = { [this.name]: options.default || {} }; + this.commandOptions = options.commandOptions || []; + } /** @@ -79,6 +81,37 @@ class Setting extends Component { hook.collector = await this.collector(wrapper, selectMenu); } + usageEmbed(guild, verbose = false) { + + const fields = []; + + if (this.commandOptions.length) { + fields.push({ + name: `》 ${guild.format(`GENERAL_OPTIONS`)}`, + value: this.commandOptions.map((opt) => `**${opt.name} [${opt.type}]:** ${opt.description} ${opt.choices.length ? `\n__${guild.format('GENERAL_CHOICES')}__\n\t${opt.choices.map((choice) => choice.name).join('\n\t')}` : ''}`).join('\n') + }); + } + + return { + author: { + name: `${this.display} [module:${this.module.name}]` + }, + description: this.description, + fields + }; + + } + + /** + * Should return fields with current setting values + * @abstract + * @return {Array} + * @memberof Setting + */ + fields() { + return []; + } + /** * Creates an interaction collector that passes the control to onCollect * @param {InteractionWrapper} wrapper Interaction wrapper