diff --git a/commands/statistics.js b/commands/statistics.js index 35268a3..e8c585e 100644 --- a/commands/statistics.js +++ b/commands/statistics.js @@ -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, ''))