!set_prefix command is deleting network in config.json
Closed this issue · 0 comments
JohnGarnham commented
When a user calls set_prefix and changes the prefix, when it updates config.json with the new prefix it is not keeping the network setting. Which means that the network gets wiped out whenever the command prefix is changed. Error is in:
// Read in new prefix
var newPrefix = args[0];
// Create new config
var newConfig = {
token: oldConfig.token,
prefix: newPrefix,
};
// Write new config
try {
fs.writeFileSync("config.json", JSON.stringify(newConfig, null, 2), function(err, result) {
if (err) throw err;
});
} catch(e) {
// Error updating config file
console.error("Error writing new config.json: " + e);
console.error(e.stack);
message.channel.send("Could not set new command prefix: " + e);
}