Browse Source

Add more logging

ghorsington 4 years ago
parent
commit
71a1b0ef70
1 changed files with 3 additions and 1 deletions
  1. 3 1
      bot/src/rpc.ts

+ 3 - 1
bot/src/rpc.ts

@@ -31,7 +31,9 @@ async function checkUser(action: string, userId: string, check: (user: GuildMemb
         }
         const user = await tryDo(guildInstance.result.members.fetch(userId));
         if (!user.ok) {
-            logger.warn("Couldn't %s for user %s on server %s because: %s", action, userId, guild.guildId, user.error);
+            const userInfo = await tryDo(client.bot.users.fetch(userId));
+            const userName = userInfo.ok ? `${userInfo.result.username}#${userInfo.result.discriminator}` : "???";
+            logger.warn("Couldn't %s for user %s (%s) on server %s because: %s", action, userId, userName, guild.guildId, user.error);
         }
         if (user.ok && await check(user.result, guild)) {
             return true;