I'm having problems to initialize whatsapp-web.js inside a class. Had anyone done this before?
I wrote on one file
class Whatsapp extends Client{
constructor() {
super();
this.startBot()
}
startBot(){
this.on('send', async (number, message) => {
this.client.sendMessage(number, message);
});
}
}
module.exports = Whatsapp; // Exporting the extended class```
and then I call
const Whatsapp=require('whatsapp');
const LocalAuth = require('whatsapp-web.js');
const whatsapp = new Whatsapp({
authStrategy: new LocalAuth(),
});
and I get the error :
class Whatsapp extends Client{
^
TypeError: Class extends value #<Object> is not a constructor or null