From e4d495f07c2c960e4774861dd1a2228d253c6909 Mon Sep 17 00:00:00 2001 From: Xaliks Date: Sun, 15 Jan 2023 18:34:23 +0300 Subject: [PATCH] fix `null is typing...` --- js/addMemberList.js | 4 ++-- js/buildMemberMenu.js | 2 +- js/parseMessage.js | 4 ++-- js/typingStatus.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/js/addMemberList.js b/js/addMemberList.js index cd2f1b7b..92ecc3d1 100644 --- a/js/addMemberList.js +++ b/js/addMemberList.js @@ -81,7 +81,7 @@ function addMemberList(guild) { // Make the username text let username = document.createElement('p'); username.classList.add('mLUsername'); - let name = m.nickname || m.user.username; + let name = m.displayName; // if (name.length > 15) { // name = `${name.substring(0, 15)}...` // } @@ -195,7 +195,7 @@ function addMemberList(guild) { // Make the username text let username = document.createElement('p'); username.classList.add('mLUsername'); - username.innerText = m.nickname || m.user.username; + username.innerText = m.displayName; username.style.color = m.roles.color?.hexColor || '#8E9297'; userDiv.appendChild(username); }); diff --git a/js/buildMemberMenu.js b/js/buildMemberMenu.js index cd0fb49f..2670c374 100644 --- a/js/buildMemberMenu.js +++ b/js/buildMemberMenu.js @@ -41,7 +41,7 @@ function buildMemberMenu(parent) { // Username and nickname let topName = document.createElement('span'); topName.classList.add('memberTopName'); - topName.innerText = member.nickname || member.user.username; + topName.innerText = member.displayName; user.appendChild(topName); if (member.nickname) { diff --git a/js/parseMessage.js b/js/parseMessage.js index dc5dae71..0c34c69c 100644 --- a/js/parseMessage.js +++ b/js/parseMessage.js @@ -105,7 +105,7 @@ function formatPings(msg, text, dms) { let user = dms ? bot.users.cache.get(id) : msg.guild.members.cache.get(id); - name = user ? user.nickname || (user.user || user).username : id; + name = user?.displayName || user?.username || id; } else if (type == 'role' && !dms) { let role = msg.guild.roles.cache.get(id); name = role ? role.name : id; @@ -164,7 +164,7 @@ function formatEmbedPings(msg, text, dms) { let user = dms ? bot.users.cache.get(id.replace(/!/, '')) : msg.guild.members.cache.get(id.replace(/!/, '')); - name = user ? user.nickname || (user.user || user).username : id; + name = user?.displayName || user?.username || id; if (name == id && !dms) { let role = msg.guild.roles.cache.get(id); diff --git a/js/typingStatus.js b/js/typingStatus.js index 6cd34e2a..72897354 100644 --- a/js/typingStatus.js +++ b/js/typingStatus.js @@ -84,7 +84,7 @@ function typingStatus(override = false, m = undefined) { } for (let user in users) { - let name = dms ? users[user].username : users[user].nickname; + let name = dms ? users[user].username : users[user].displayName; if (user != length - 1) text += name + ', '; else text += name; }