method resolver shorthand

This commit is contained in:
Erik 2020-05-24 01:12:52 +03:00
parent cb05185f1e
commit dae5918000

View File

@ -47,13 +47,26 @@ class Setting extends Component {
return { parsedArguments: response.parsedArguments, params: response.newArgs, error: false }; return { parsedArguments: response.parsedArguments, params: response.newArgs, error: false };
} }
/**
* Resolves methods used primarily for settings, also deals with appending the arguments into existing lists
*
* @param {Array<String>} args The incoming arguments with the first element being the method ex. ['add','ban','kick']
* @param {Array<String>} valid An array of items to compare to, if an argument doesn't exist in this array it'll be skipped over
* @param {Array<String>} [existing=[]] Existing values in the array, valid elements will be appended to this
* @returns {Object}
* @memberof Resolver
*/
resolveMethod(args, valid, existing) {
return this.client.resolver.resolveMethod(args, valid, existing);
}
reason(executor) { reason(executor) {
return `[${this.moduleResolveable}] Executed by ${executor.tag} (${executor.id}).`; return `[${this.moduleResolveable}] Executed by ${executor.tag} (${executor.id}).`;
} }
async _handleReset(message) { async _handleReset(message) {
await message.guild._removeSettings(this.index); await message.guild._removeSettings(this.index);
const msg = message.format('GENERAL_SETTINGRESET', { setting: this.resolveable }); const msg = message.format('GENERAL_SETTINGRESET', { setting: this.name.toLowerCase() });
return { return {
error: false, error: false,
msg msg