我在 JS 中有一段代码:
var commands = require('commands.json');
module.exports = class CatCommand extends commando.Command {
constructor(client) {
super(client, {
name: 'cat',
group: 'fun',
aliases: commands[this.group][this.name].aliases || [utils.translate(this.name)],
memberName: name,
description: commands[this.group][this.name].description || 'No description',
examples: commands[this.group][this.name].usages || ['No examples'],
throttling: {
usages: 2,
duration: 5
}
});
}
async run(message) {}
}
我需要使用变量name
和group
作为commands
'键。最好的方法是什么?