我有一个单独的 JSON 文件,链接为
const Players = require('./Database/Players.json');
和一个遍历代码的 praser
client.on('message', message => {
if (message.content.toLowerCase() ==='smack activate') {
let PlayerData = [message.author.username];
Activate [message.author.username] = {
AccountActive: 1,
Health: 100,
Level: 1,
Lust: 0,
Items: ""
};
var parsedata = JSON.parse(Players) // <-----------
if (parsedata.PlayerData.accountactive === 1) {
message.channel.send ("Account Already Activated");
return;
}
fs.writeFile("./Database/Players.json", JSON.stringify (Activate, null, 4), err => {
if (err) throw err;
message.channel.send ("Account Activated")
});
};
但似乎没有任何效果..我做错了什么?我收到此错误消息
undefined:1
[object Object]
^
婷婷同学_
料青山看我应如是
相关分类