add static fromProps

This commit is contained in:
LenAnderson
2024-04-23 12:40:17 -04:00
parent 17ea31188e
commit 1400f6eac4

View File

@ -3,6 +3,27 @@ import { SlashCommandArgument, SlashCommandNamedArgument } from './SlashCommandA
export class SlashCommand {
/**
* Creates a SlashCommand from a properties object.
* @param {Object} props
* @param {string} [props.name]
* @param {Function} [props.callback]
* @param {string} [props.helpString]
* @param {boolean} [props.interruptsGeneration]
* @param {boolean} [props.purgeFromMessage]
* @param {string[]} [props.aliases]
* @param {string} [props.returns]
* @param {SlashCommandNamedArgument[]} [props.namedArgumentList]
* @param {SlashCommandArgument[]} [props.unnamedArgumentList]
*/
static fromProps(props) {
const instance = Object.assign(new this(), props);
return instance;
}
/**@type {string}*/ name;
/**@type {Function}*/ callback;
/**@type {string}*/ helpString;