SetupSonic / d2bot-with-kolbot-sonic

13 stars 17 forks source link

JSON.parse Error #29

Open sunproc88 opened 3 years ago

sunproc88 commented 3 years ago

when i try to start sonic, İ take this error

[Error (228)] File (kolbot/d2botsonic.dbj:83) SyntaxError: JSON.parse:unexpected character

this is the code

let SETTINGS = {};

const settingsToLegacySonicFormat = jsonObj => { return jsonObj.reduce((acc, val) => { const p = val.profile; delete val.profile;

acc[p] = JSON.parse(JSON.stringify(val));

return acc;

}, {}); };

(function(native) { include = script => { script = script.toLowerCase();

if (script === 'sonic/settings/settings.js') {
  SETTINGS = settingsToLegacySonicFormat(
    JSON.parse(FileTools.readText('libs/sonic/settings/Settings.json'))   ------>>>> **this is code 83**
  );

  return true;
} else {
  return native(script);
}

};