#Best way to create a collection of bot commands
10 messages · Page 1 of 1 (latest)
like this?
class CmdClient extends Client{
commands = new Collection();
constructor(args){
super(args);
for(let command of fs.readdirSync("./commands"){
const cmd = require(`./commands/${command}`);
this.commands.set(cmd.data.name,cmd);
}
}
}
@dusky turret
Don’t ping me. There’s literally only you and me in this post atm
sr, I just didn't want to wait 3h for a response
yes but it's better to define the type of the collection too because you know the type of the keys and values
how?
im using js, not ts, so not sure if i can do it
JSDoc comments
/**
* @type Collection<string, CustomDefinedType>
*/
command = new Collection();