Setup Command discord bot need help

Yea, I need help on the Setup Command for my discord bot.
Hers the output for it:

"\n\"cookie\": \"\",\n\"groupId\": 0,\n\"maximumRank\": 0,\n\"shiftmessage\": \"\",\n\"trainingmessage\": \"\"\n```"
const filter = m => m.author.id === message.author.id
const collector = message.channel.createMessageCollector(filter, { max: '1', maxMatches: "1", time: "200000" })    
collector.on('collect', msg => {
   if(msg.content){
       fs.writeFile('./config.json', JSON.stringify(msg.content), (err) => {
             if(err){
                   return SendSetupMessage("Error",err,'RED')
                }
            })
        }
    })
}

Is there any way to fix it?
The setup command is for when a user setups up the bots settings, etc.

I suggest asking for “help” on the glitch page itself. I, and others, check there a lot, and people could help you with that :smiley:

I will admit, I don’t think I can help you other that that.

What do you want the output to be?

{
    "cookie": "",
    "groupId": 0,
    "maxrank": 0,
}

Try JSON.parse(msg.content) instead of JSON.stringify because the message is already a string. JSON.stringify() is used to convert an object into a string and JSON.parse() does the reverse.

1 Like

Tried that but it came to a error.