Currently utilizing the WhatsApp Web JS package and have created this function. I am trying to make it return a client that is ready to use eventually. I attempted using a promise that resolves when the "ready" event is triggered, but it seems like the event never triggers. Any suggestions?
await mongoose.connect(process.env.MONGODB_URI!)
const store = new MongoStore({ mongoose: mongoose })
const client = new Client({
authStrategy: new RemoteAuth({
store: store,
backupSyncIntervalMs: 300000,
}),
})
console.log("initializing client")
client.initialize()
return new Promise<wweb.Client>((resolve, reject) => {
client.on("ready", () => {
console.log("client is ready")
resolve(client)
})
})
}