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