hi everyone i need help :
i save my discord bot ping in json file and i want to show the ping from the json file in my web server HTML iam using express.js
this enter image description here here is pic of the data but its not getting update when it change in json file
The Codes :
this in my express project
app.get('/', function(req, res){
const pingsBots = require('./Database/BotPing.json')
const pingofbot = pingsBots.thepingofbot.botping
let file = fs.readFileSync(path.join(__dirname, './html/', 'main.html'), { encoding: 'utf-8' })
file = file.replace("$$theping$$", pingofbot)
res.sendFile(path.join(__dirname, './html/', 'main.html'))
res.send(file)
})
And this in ready method in my bot :
setInterval(function(){
let Pusher = JSON.parse(fs.readFileSync('./Database/BotsPing.json', 'utf8'));
Pusher["thepingofbot"] = {
botping: `${client.ws.ping}`
}
async function SavePingData(path, JSONdata){
fs.writeFileSync(path, JSON.stringify(JSONdata, null, 2))
}
SavePingData('./Database/BotsPing.json', Pusher)
}, 1000)
BTW : express project not with the bot project