Im new to coding and I've coded myself a discord bot coded in Node.js which can change the whole config.json, start the bot, stop the bot, create instances etc... I'm stuck at a part where I want to change a specific part of the config.json and not the whole config.
{
   "cookie": "",
   "proxy": "",
   "webhook": "https://discord.com/api/webhooks/...",
   "sending": [
     1647598632,
     1647676420
   ],
   "receiving": [
     124127383
   ]
 }
I want to change the "Sending" (currently 1647598632, 1647676420) and "Receiving" (currently 124127383) stuff from a simple discord command such as,
 $mass_send 124127383 [1647598632,1647676420].
I want it so I can change the ID's. If you would like to cross reference with the code I made for changing the whole config not specific variables please let me know. Thank you to whoever helps.
I do have a Config updater command, but it updates the whole config rather than a specific part of the config
    }
else if (command === '$setconfig') {
    if (message.attachments.size < 1)
        return message.reply({
            embeds: [
                new MessageEmbed()
                .setColor('RED')
                .setDescription('Please attach a new config file.')
            ]
        })
   
    const attachment = message.attachments.first();
    console.log(attachment);
   
    if (!attachment.contentType || attachment.contentType.indexOf('text/plain') < 0)
        return message.reply({
            embeds: [
                new MessageEmbed()
                .setColor('RED')
                .setDescription('Config must be a .txt/.ini file.')
            ]
        })
   
    superagent('GET', attachment.url)
    .then(resp => {
        const configText = resp.text;
       
        try {
            ini.parse(configText);
        } catch {
            return message.reply({
                embeds: [
                    new MessageEmbed()
                    .setColor('RED')
                    .setDescription('Failed to parse ini file.')
                ]
            })
        }
       
        fs.writeFileSync(instanceDirectory + '/settings.ini', configText);
        return message.reply({
            embeds: [
                new MessageEmbed()
                .setColor('RED')
                .setDescription('Config file successfully updated.\nstop the bot with `$stop`')
            ]
        })
    })
I want to edit a specific part rather than the Whole entire config. Please let me know if this is possible Thanks! Also Please let me know if it is unclear, i can provide more information.
 
    