mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-10 02:20:18 +00:00
Made changes to statistics command
This commit is contained in:
parent
e8080fb205
commit
76506e8c7c
@ -6,27 +6,24 @@ module.exports = {
|
|||||||
permission: 'none',
|
permission: 'none',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
execute(msg, args, client, Discord, command) {
|
execute(msg, args, client, Discord, command) {
|
||||||
|
let message = {};
|
||||||
let stations = client.stations;
|
let stations = client.stations;
|
||||||
let currentGuild = client.datastore.getEntry(msg.guild.id);
|
let currentGuild = client.datastore.getEntry(msg.guild.id);
|
||||||
let statistics;
|
let statistics = "";
|
||||||
let i = 0;
|
|
||||||
|
if(!client.stations) {
|
||||||
|
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||||
|
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||||
|
}
|
||||||
|
|
||||||
if(!currentGuild || currentGuild && !currentGuild.statistics){
|
if(!currentGuild || currentGuild && !currentGuild.statistics){
|
||||||
statistics = "You have not listened any radio station";
|
statistics = "You have not listened any radio station";
|
||||||
} else {
|
} else {
|
||||||
Object.keys(client.stations).forEach(function(station) {
|
Object.keys(stations).forEach(function(station) {
|
||||||
if(currentGuild.statistics[stations[station].name]){
|
if(currentGuild.statistics[stations[station].name] && currentGuild.statistics[stations[station].name].time && parseInt(currentGuild.statistics[stations[station].name].time) > 0 && currentGuild.statistics[stations[station].name].used && parseInt(currentGuild.statistics[stations[station].name].used) > 0){
|
||||||
if(i > 0){
|
statistics += `**${parseInt(station) + 1}** ` + stations[station].name + " \n";
|
||||||
statistics += `**${parseInt(station) + 1}** ` + stations[station].name + " \n";
|
statistics += "Time: " + client.funcs.msToTime(currentGuild.statistics[stations[station].name].time, "hh:mm:ss") + "\n";
|
||||||
statistics += "Time: " + client.funcs.msToTime(currentGuild.statistics[stations[station].name].time, "hh:mm:ss") + "\n";
|
statistics += "Used: " + currentGuild.statistics[stations[station].name].used + "\n";
|
||||||
statistics += "Used: " + currentGuild.statistics[stations[station].name].used + "\n";
|
|
||||||
} else {
|
|
||||||
statistics = `**${parseInt(station) + 1}** ` + stations[station].name + " \n";
|
|
||||||
statistics += "Time: " + client.funcs.msToTime(currentGuild.statistics[stations[station].name].time, "hh:mm:ss") + "\n";
|
|
||||||
statistics += "Used: " + currentGuild.statistics[stations[station].name].used + "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user