From 3bdd0384f48092e376d255e8d67df151c6815a79 Mon Sep 17 00:00:00 2001 From: Miikka Virtanen Date: Wed, 15 Feb 2017 01:19:08 +0200 Subject: [PATCH] Don't you love bugs that only show up in prod? --- src/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 981e57f..3d83150 100644 --- a/src/index.js +++ b/src/index.js @@ -126,7 +126,15 @@ Here's what their message contained: const memberPromise = (mainGuild ? mainGuild.getRESTMember(msg.author.id) : Promise.resolve()); threadInitDonePromise = memberPromise - .catch(err => { + .then(member => { + if (! member) return null; + // If the member doesn't have user data on it, try fetching that manually + if (! member.user) return restBot.getRESTUser(member.id).then(user => { + member.user = user; + return member; + }); + return member; + }, err => { console.log(`Member ${msg.author.id} not found in main guild ${config.mainGuildId}`); console.error(String(err)); })