I'm trying to make some discord bots, and I'm getting frustrated trying to use a class I created in another script. The script in question looks like this:
// utils.js
class BotUtils {
constructor(param1, param2, ...) {
this.param1 = param1;
this.param2 = param2;
...
}
someMethod() {
doSomething;
}
}
module.exports = {BotUtils};
In my bot script, I have:
// bot.js
const botUtils = require('./BotUtils');
let utils = new BotUtils(param1, param2, ...);
And I get TypeError: BotUtils is not a constructor
I've also tried using new
but it doesn't work. I need to construct the class with the specific parameters. What's the correct way to do this?