mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
refactor: change remaining parameter names
This commit is contained in:
@@ -123,7 +123,7 @@ class ApplicationCommand extends Base {
|
||||
* The options of this command
|
||||
* @type {ApplicationCommandOption[]}
|
||||
*/
|
||||
this.options = data.options.map(o => this.constructor.transformOption(o, true));
|
||||
this.options = data.options.map(opt => this.constructor.transformOption(opt, true));
|
||||
} else {
|
||||
this.options ??= [];
|
||||
}
|
||||
@@ -577,7 +577,7 @@ class ApplicationCommand extends Base {
|
||||
[nameLocalizationsKey]: choice.nameLocalizations ?? choice.name_localizations,
|
||||
value: choice.value,
|
||||
})),
|
||||
options: option.options?.map(o => this.transformOption(o, received)),
|
||||
options: option.options?.map(opt => this.transformOption(opt, received)),
|
||||
[channelTypesKey]: option.channelTypes ?? option.channel_types,
|
||||
[minValueKey]: option.minValue ?? option.min_value,
|
||||
[maxValueKey]: option.maxValue ?? option.max_value,
|
||||
|
||||
@@ -18,8 +18,8 @@ function flatten(obj, ...props) {
|
||||
if (!isObject(obj)) return obj;
|
||||
|
||||
const objProps = Object.keys(obj)
|
||||
.filter(k => !k.startsWith('_'))
|
||||
.map(k => ({ [k]: true }));
|
||||
.filter(key => !key.startsWith('_'))
|
||||
.map(key => ({ [key]: true }));
|
||||
|
||||
props = objProps.length ? Object.assign(...objProps, ...props) : Object.assign({}, ...props);
|
||||
|
||||
@@ -39,7 +39,7 @@ function flatten(obj, ...props) {
|
||||
// If the valueOf is a Collection, use its array of keys
|
||||
else if (valueOf instanceof Collection) out[newProp] = Array.from(valueOf.keys());
|
||||
// If it's an array, call toJSON function on each element if present, otherwise flatten each element
|
||||
else if (Array.isArray(element)) out[newProp] = element.map(e => e.toJSON?.() ?? flatten(e));
|
||||
else if (Array.isArray(element)) out[newProp] = element.map(elm => elm.toJSON?.() ?? flatten(elm));
|
||||
// If it's an object with a primitive `valueOf`, use that value
|
||||
else if (typeof valueOf !== 'object') out[newProp] = valueOf;
|
||||
// If it's an object with a toJSON function, use the return value of it
|
||||
|
||||
Reference in New Issue
Block a user