Handle error when guild member doesn't have a user

master
Miikka Virtanen 2017-02-15 01:14:26 +02:00
parent 2281d01d8c
commit 1a44065b61
1 changed files with 6 additions and 1 deletions

View File

@ -131,7 +131,12 @@ Here's what their message contained:
console.error(String(err));
})
.then(member => {
const mainGuildNickname = (member != null ? (member.nick || member.username) : 'UNKNOWN');
let mainGuildNickname = null;
if (member && member.nick) mainGuildNickname = member.nick;
else if (member && member.user) mainGuildNickname = member.user.username;
if (mainGuildNickname == null) mainGuildNickname = 'UNKNOWN';
const accountAge = humanizeDuration(Date.now() - msg.author.createdAt, {largest: 2});
const infoHeader = `ACCOUNT AGE **${accountAge}**, ID **${msg.author.id}**, NICKNAME **${mainGuildNickname}**, LOGS **${userLogs.length}**\n-------------------------------`;