Updated statisticsUpdate function

This commit is contained in:
Christer Warén 2021-08-08 20:06:30 +03:00
parent 6a11482110
commit 95e8b17ddd

View File

@ -11,14 +11,10 @@ module.exports = function statisticsUpdate(client, guild, radio) {
client.datastore.updateEntry(guild, radio.currentGuild); client.datastore.updateEntry(guild, radio.currentGuild);
} }
if(!radio.connection.dispatcher){ let date = new Date();
let date = new Date(); radio.currentTime = date.getTime();
radio.currentTime = date.getTime(); radio.playTime = parseInt(radio.currentTime)-parseInt(radio.startTime);
radio.playTime = parseInt(radio.currentTime)-parseInt(radio.startTime); radio.currentGuild.statistics[radio.station.name].time = parseInt(radio.currentGuild.statistics[radio.station.name].time)+parseInt(radio.playTime);
radio.currentGuild.statistics[radio.station.name].time = parseInt(radio.currentGuild.statistics[radio.station.name].time)+parseInt(radio.playTime);
} else {
radio.currentGuild.statistics[radio.station.name].time = parseInt(radio.currentGuild.statistics[radio.station.name].time)+parseInt(radio.connection.dispatcher.streamTime.toFixed(0));
}
radio.currentGuild.statistics[radio.station.name].used = parseInt(radio.currentGuild.statistics[radio.station.name].used)+1; radio.currentGuild.statistics[radio.station.name].used = parseInt(radio.currentGuild.statistics[radio.station.name].used)+1;
client.datastore.updateEntry(guild, radio.currentGuild); client.datastore.updateEntry(guild, radio.currentGuild);