2020-03-31 06:53:58 +00:00
|
|
|
module.exports = {
|
|
|
|
name: 'statistics',
|
|
|
|
alias: 'stats',
|
|
|
|
usage: '',
|
|
|
|
description: 'Show usage statistics.',
|
|
|
|
permission: 'none',
|
|
|
|
category: 'info',
|
|
|
|
execute(msg, args, client, Discord, command) {
|
|
|
|
let stations = client.stations;
|
2020-03-31 07:23:46 +00:00
|
|
|
let currentGuild = client.datastore.getEntry(msg.guild.id);
|
2020-03-31 06:53:58 +00:00
|
|
|
let statistics;
|
|
|
|
let i = 0;
|
|
|
|
|
2020-03-31 07:37:47 +00:00
|
|
|
if(!currentGuild || currentGuild && !currentGuild.statistics){
|
|
|
|
statistics = "You have not listened any radio station";
|
|
|
|
} else {
|
2020-03-31 07:23:46 +00:00
|
|
|
Object.keys(client.stations).forEach(function(station) {
|
|
|
|
if(currentGuild.statistics[stations[station].name]){
|
|
|
|
if(i > 0){
|
|
|
|
statistics += "**" + station + " " + stations[station].name + "** \n";
|
2020-04-02 05:13:51 +00:00
|
|
|
statistics += "Time: " + client.funcs.msToTime(currentGuild.statistics[stations[station].name].time, "hh:mm:ss") + "\n";
|
2020-03-31 07:23:46 +00:00
|
|
|
statistics += "Used: " + currentGuild.statistics[stations[station].name].used + "\n";
|
|
|
|
} else {
|
|
|
|
statistics = "**" + station + " " + stations[station].name + "** \n";
|
2020-04-02 05:13:51 +00:00
|
|
|
statistics += "Time: " + client.funcs.msToTime(currentGuild.statistics[stations[station].name].time, "hh:mm:ss") + "\n";
|
2020-03-31 07:23:46 +00:00
|
|
|
statistics += "Used: " + currentGuild.statistics[stations[station].name].used + "\n";
|
|
|
|
}
|
|
|
|
i++;
|
2020-03-31 06:53:58 +00:00
|
|
|
}
|
2020-03-31 07:23:46 +00:00
|
|
|
});
|
|
|
|
}
|
2020-03-31 06:53:58 +00:00
|
|
|
|
|
|
|
const embed = new Discord.MessageEmbed()
|
|
|
|
.setTitle(client.messages.statisticsTitle)
|
2020-04-01 14:34:18 +00:00
|
|
|
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["statistics"].replace(/[^0-9]+/g, ''))
|
2020-03-31 06:53:58 +00:00
|
|
|
.setColor(client.config.embedColor)
|
|
|
|
.setDescription(statistics)
|
|
|
|
.setFooter('EximiaBots by Warén Media', "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
|
|
|
return msg.channel.send(embed);
|
|
|
|
}
|
2020-04-02 05:13:51 +00:00
|
|
|
};
|