mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-10 03:40:19 +00:00
Updated statisticsUpdate.js
This commit is contained in:
parent
a8fc38ffca
commit
179914a2f2
@ -2,21 +2,21 @@ module.exports = function statisticsUpdate(client, guild, radio) {
|
|||||||
|
|
||||||
client.datastore.checkEntry(guild.id);
|
client.datastore.checkEntry(guild.id);
|
||||||
|
|
||||||
radio.currentGuild = client.datastore.getEntry(guild.id);
|
radio.datastore = client.datastore.getEntry(guild.id);
|
||||||
|
|
||||||
if(!radio.currentGuild.statistics[radio.station.name]){
|
if(!radio.datastore.statistics[radio.station.name]){
|
||||||
radio.currentGuild.statistics[radio.station.name] = {};
|
radio.datastore.statistics[radio.station.name] = {};
|
||||||
radio.currentGuild.statistics[radio.station.name].time = 0;
|
radio.datastore.statistics[radio.station.name].time = 0;
|
||||||
radio.currentGuild.statistics[radio.station.name].used = 0;
|
radio.datastore.statistics[radio.station.name].used = 0;
|
||||||
client.datastore.updateEntry(guild, radio.currentGuild);
|
client.datastore.updateEntry(guild, radio.datastore);
|
||||||
}
|
}
|
||||||
|
|
||||||
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.datastore.statistics[radio.station.name].time = parseInt(radio.datastore.statistics[radio.station.name].time)+parseInt(radio.playTime);
|
||||||
|
|
||||||
radio.currentGuild.statistics[radio.station.name].used = parseInt(radio.currentGuild.statistics[radio.station.name].used)+1;
|
radio.datastore.statistics[radio.station.name].used = parseInt(radio.datastore.statistics[radio.station.name].used)+1;
|
||||||
client.datastore.updateEntry(guild, radio.currentGuild);
|
client.datastore.updateEntry(guild, radio.datastore);
|
||||||
client.datastore.calculateGlobal(client);
|
client.datastore.calculateGlobal(client);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user