userinfo: anyMember null checks

This commit is contained in:
Cynthia Foxwell 2024-08-13 23:25:39 -06:00
parent a387eb9b2a
commit 111107eff2

View file

@ -245,12 +245,14 @@ userinfo.callback = async function (msg, line) {
if (anyMember) { if (anyMember) {
const icons = []; const icons = [];
if (anyMember.clientStatus) {
for (const platform of Object.keys(anyMember.clientStatus)) { for (const platform of Object.keys(anyMember.clientStatus)) {
const status = anyMember.clientStatus[platform]; const status = anyMember.clientStatus[platform];
if (status == "offline") continue; if (status == "offline") continue;
icons.push(Icons.presence[platform][status]); icons.push(Icons.presence[platform][status]);
} }
}
descLines.push(""); descLines.push("");
if (icons.length > 0) { if (icons.length > 0) {
@ -259,6 +261,7 @@ userinfo.callback = async function (msg, line) {
descLines.push(Icons.offline.replace(":i:", ":Offline:")); descLines.push(Icons.offline.replace(":i:", ":Offline:"));
} }
if (anyMember.activities?.length > 0) {
for (const activity of anyMember.activities) { for (const activity of anyMember.activities) {
if (activity.type == 4 || activity.type == 6) { if (activity.type == 4 || activity.type == 6) {
descLines.push(ActivityTypeNames[activity.type]); descLines.push(ActivityTypeNames[activity.type]);
@ -267,6 +270,7 @@ userinfo.callback = async function (msg, line) {
} }
} }
} }
}
const embed = { const embed = {
color: user.accent_color, color: user.accent_color,