From 0402052870022047fcbde6fd268fd04f3c2a2921 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sun, 27 Oct 2019 13:15:31 +0100 Subject: [PATCH] made it show "no one :(" when there is no entry in the donator table --- commands/utility/donator.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/commands/utility/donator.js b/commands/utility/donator.js index a734cfad..30db68f8 100644 --- a/commands/utility/donator.js +++ b/commands/utility/donator.js @@ -19,8 +19,12 @@ class donatorCommand extends Command { let donatorMessage = 'Thanks to:\n'; - for (let i = 0; i < Donator.length; i++) { - donatorMessage += `${this.client.users.get(Donator[i].get('userID')).username}#${this.client.users.get(Donator[i].get('userID')).discriminator} (${Donator[i].get('userID')}) ${Donator[i].get('comment')}\n`; + if (Donator[0]) { + for (let i = 0; i < Donator.length; i++) { + donatorMessage += `**${this.client.users.get(Donator[i].get('userID')).username}#${this.client.users.get(Donator[i].get('userID')).discriminator} (${Donator[i].get('userID')}) ${Donator[i].get('comment')}**\n`; + } + } else { + donatorMessage += 'No one :('; } return message.channel.send(donatorMessage);