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,11 +245,13 @@ userinfo.callback = async function (msg, line) {
if (anyMember) {
const icons = [];
for (const platform of Object.keys(anyMember.clientStatus)) {
const status = anyMember.clientStatus[platform];
if (status == "offline") continue;
if (anyMember.clientStatus) {
for (const platform of Object.keys(anyMember.clientStatus)) {
const status = anyMember.clientStatus[platform];
if (status == "offline") continue;
icons.push(Icons.presence[platform][status]);
icons.push(Icons.presence[platform][status]);
}
}
descLines.push("");
@ -259,11 +261,13 @@ userinfo.callback = async function (msg, line) {
descLines.push(Icons.offline.replace(":i:", ":Offline:"));
}
for (const activity of anyMember.activities) {
if (activity.type == 4 || activity.type == 6) {
descLines.push(ActivityTypeNames[activity.type]);
} else {
descLines.push(`${ActivityTypeNames[activity.type]} **${activity.name}**`);
if (anyMember.activities?.length > 0) {
for (const activity of anyMember.activities) {
if (activity.type == 4 || activity.type == 6) {
descLines.push(ActivityTypeNames[activity.type]);
} else {
descLines.push(`${ActivityTypeNames[activity.type]} **${activity.name}**`);
}
}
}
}