Fixed statistics command when guild has empty statistics (part 2)

This commit is contained in:
Christer Warén 2020-03-31 10:37:47 +03:00
parent 20d5d8b3bd
commit 94344bbecd

View File

@ -11,7 +11,9 @@ module.exports = {
let statistics;
let i = 0;
if(currentGuild.statistics){
if(!currentGuild || currentGuild && !currentGuild.statistics){
statistics = "You have not listened any radio station";
} else {
Object.keys(client.stations).forEach(function(station) {
if(currentGuild.statistics[stations[station].name]){
if(i > 0){
@ -28,10 +30,6 @@ module.exports = {
});
}
if(!statistics){
statistics = "You have not listened any radio station";
}
const embed = new Discord.MessageEmbed()
.setTitle(client.messages.statisticsTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["list"].replace(/[^0-9]+/g, ''))