I have an application where i have a Client class, that needs to be executed with different configurations for each user when i receive a message on discord(It's a chat application having its own API calls for checking for new messages etc). I have initialized the obj constructor whenever i receive a new message with new configurations for that user, but the problem is when i receive multiple messages at the same time, only the latest user's configurations are used for all the client objects created. Attaching sample code from the application:
Wait for message code:
const app = require("./Client")
const app2 = require("./MyObject")
bot.on('message', async (message) => {
    let msg = message.content.toUpperCase(), pg;
    let client = await new app2.MyObject();
    //set all such configurations
    config.a = "valuea";
    // initialize my 
    pg = await new app.Client(config, client);
    let result = await pg.Main(bot, message, params).then((result) => {
        // Do stuff with result here
    });
});
Client class:
class Client {
    constructor(config, client) {
        this.config = config;
        this.client = client;
    }
    async Main(bot, message, params) {
        let result = {};
        this.client.setProperty1("prop");
        await this.client.doSOmething();
        result = await this.doSOmethingMore(message);
        this.client.doCleanUp();
        return result;
    }
}
I had also tried initializing the obj constructor in the Client class, but even that fails for some reason.
Any suggestions how Can i correct my code?
 
     
    