From b9955991f3e14568fab568fe1671aac917c87b7f Mon Sep 17 00:00:00 2001 From: loicbersier Date: Mon, 3 Aug 2020 11:26:20 +0200 Subject: [PATCH] Fix error for unknown id --- commands/utility/about.js | 9 +++++++-- commands/utility/donator.js | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/commands/utility/about.js b/commands/utility/about.js index e553c445..ed9d6a8c 100644 --- a/commands/utility/about.js +++ b/commands/utility/about.js @@ -17,6 +17,8 @@ class aboutCommand extends Command { }); } + + async exec(message) { const Donator = await donator.findAll({order: ['id']}); @@ -24,7 +26,10 @@ class aboutCommand extends Command { if (Donator[0]) { for (let i = 0; i < Donator.length; i++) { - description += `**${this.client.users.resolve(Donator[i].get('userID')).tag} (${Donator[i].get('userID')}) | ${Donator[i].get('comment')}**\n`; + if (this.client.users.resolve(Donator[i].get('userID')) !== null) + description += `**${this.client.users.resolve(Donator[i].get('userID')).tag} (${Donator[i].get('userID')}) | ${Donator[i].get('comment')}**\n`; + else + description += `**A user of discord (${Donator[i].get('userID')}) | ${Donator[i].get('comment')} (This user no longer share a server with the bot)**\n`; } } else { description += 'No one :(\n'; @@ -44,7 +49,7 @@ class aboutCommand extends Command { .addField('Gitlab', 'https://gitlab.com/LoicBersier/DiscordBot', true) .addField('Github', 'https://github.com/loicbersier/Haha-yes', true) .setThumbnail('https://its.gamingti.me/ZiRe.png') - .setFooter(`Original bot made by ${this.client.users.resolve('267065637183029248').tag} (267065637183029248)`); // Please don't change the "original bot made by" + .setFooter(`Original bot made by ${this.client.users.resolve('267065637183029248').tag} (267065637183029248)`); // Please this line message.channel.send(aboutEmbed); }); diff --git a/commands/utility/donator.js b/commands/utility/donator.js index cd7416bd..e691a2e3 100644 --- a/commands/utility/donator.js +++ b/commands/utility/donator.js @@ -22,7 +22,11 @@ class donatorCommand extends Command { if (Donator[0]) { for (let i = 0; i < Donator.length; i++) { - donatorMessage += `**${this.client.users.resolve(Donator[i].get('userID')).tag} (${Donator[i].get('userID')}) | ${Donator[i].get('comment')}**\n`; + if (this.client.users.resolve(Donator[i].get('userID')) !== null) + donatorMessage += `**${this.client.users.resolve(Donator[i].get('userID')).tag} (${Donator[i].get('userID')}) | ${Donator[i].get('comment')}**\n`; + else + donatorMessage += `**A user of discord (${Donator[i].get('userID')}) | ${Donator[i].get('comment')} (This user no longer share a server with the bot)**\n`; + } } else { donatorMessage += 'No one :(';