userinfo: anyMember null checks
This commit is contained in:
		
							parent
							
								
									a387eb9b2a
								
							
						
					
					
						commit
						111107eff2
					
				
					 1 changed files with 13 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -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}**`);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue