I don't know why this is coming up I've been watching a tutorial and it's fine when the other person does it. Im fairly new at coding, there is also another file i have in the folder with my core file, and that explains the userdata input
const Discord = require('discord.js');
const { prefix, token } = require('./config.json');
const client = new Discord.Client();
const fs = require ('fs');
let userData = JSON.parse(fs.readFileSync('Storage/userData.json', 'utf8'))
client.once('ready', () => {
console.log('Ready!');
});
client.on('message', async message => {
//Ingore if sent by bot
if(message.author.bot) return;
//Ingore if sent in dm
if(message.channel.type == "dm"){return;}
if(message.content.toLowerCase().includes ('ping'.toLowerCase())) {
message.channel.send('pong!');
}
//ECONOMY
if(!userData[sender.id + message.guild.id]) userData[sender.id + message.guild.id] = {}
if(!userData[sender.id + message.guild.id].money) userData[sender.id + message.guild.id].money = 10;
let userData = JSON.parse(fs.readFileSync('./Storage/userData.json', 'utf8'));
fs.writeFile('Storage/userData.json', JSON.stringify(userData), (err) => {
if (eer) console.error(err);
})
//ACCESS $
if(message.content.toLowerCase().startsWith ('MONEY'.toLowerCase())) {
message.channel.send({embed:{
title: "Bank",
fields: [{
name: "Account Holder",
value: message.author.username,
inline: true,
},
{
name: "Account Balance",
value: userData[sender.id + message.guild.id].money,
inline: true,
}]
}})
}