made it show "no one :(" when there is no entry in the donator table

This commit is contained in:
loicbersier 2019-10-27 13:15:31 +01:00
parent 8c585951aa
commit 0402052870

View file

@ -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);