title: How would I write a changed variable to my config.js file for a permanent change?
body: <p><strong>My Problem</strong></p>
  
  <p>I am currently writing a Discord bot to be used on one server at the moment. I have set up a command that will change the prefix of the bot's commands but as soon as I restart my repl, it resets to the original prefix. I would like to change the command so that it will write to my <code>config.js</code> file to stop this from happening.</p>
  
  <hr>
  
  <p><strong>What I've Tried So Far</strong></p>
  
  <p>To be honest, I haven't tried anything yet as I have no idea where to start</p>
  
  <hr>
  
  <p><strong>My code Files</strong></p>
  
  <p>config.js file:</p>
  
  <pre><code>var config={};
  config.token = "My Bot Token";
  config.prefix = "//";
  config.statusMessage = "video games | (" + config.prefix + "help)";
  config.dbltoken = undefined;
  module.exports = config;
  </code></pre>
  
  <p>change-prefix.js file:</p>
  
  <pre><code>config = require('../config.js');
  module.exports = (client, message, args) =&gt; {
    config.prefix = args;
    message.reply("Prefix has been changed to: " + config.prefix);
    console.log("Command Used: Change-Prefix");
  }
  </code></pre>
  
  <hr>
  
  <p><strong>What Should Happen</strong></p>
  
  <p>The <code>change-prefix.js</code> file should successfully write the new prefix determined by the user to the <code>config.js</code> file. At this moment in time, I have no errors, but I would like to change this as it would vastly improve the user experience for my bot.</p>