userinfo: oop
This commit is contained in:
		
							parent
							
								
									29f381b18a
								
							
						
					
					
						commit
						2fca9ed7a8
					
				
					 1 changed files with 5 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -306,7 +306,8 @@ userinfo.callback = async function (msg, line) {
 | 
			
		|||
    descLines.push("**System account**");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const primaryGuild = await getGuild(user.primary_guild.identity_guild_id);
 | 
			
		||||
  let primaryGuild;
 | 
			
		||||
  if (user.primary_guild?.identity_guild_id) primaryGuild = await getGuild(user.primary_guild.identity_guild_id);
 | 
			
		||||
 | 
			
		||||
  if (anyMember) {
 | 
			
		||||
    const icons = [];
 | 
			
		||||
| 
						 | 
				
			
			@ -393,11 +394,11 @@ userinfo.callback = async function (msg, line) {
 | 
			
		|||
        inline: true,
 | 
			
		||||
      },
 | 
			
		||||
      member?.roles?.length > 0 && {
 | 
			
		||||
        name: "Roles",
 | 
			
		||||
        name: `Roles (${member.roles.length})`,
 | 
			
		||||
        value: member.roles
 | 
			
		||||
          .sort((a, b) => guild.roles.get(b).position - guild.roles.get(a).position)
 | 
			
		||||
          .map((role) => `<@&${role}>`)
 | 
			
		||||
          .join(", "),
 | 
			
		||||
          .join(" "),
 | 
			
		||||
        inline: false,
 | 
			
		||||
      },
 | 
			
		||||
      shared.length > 0 && {
 | 
			
		||||
| 
						 | 
				
			
			@ -408,7 +409,7 @@ userinfo.callback = async function (msg, line) {
 | 
			
		|||
      images.length > 0 && {
 | 
			
		||||
        name: "\u200b",
 | 
			
		||||
        value: images.join("\u3000"),
 | 
			
		||||
        inline: true,
 | 
			
		||||
        inline: false,
 | 
			
		||||
      },
 | 
			
		||||
    ].filter((x) => !!x),
 | 
			
		||||
    footer: {
 | 
			
		||||
| 
						 | 
				
			
			@ -416,14 +417,6 @@ userinfo.callback = async function (msg, line) {
 | 
			
		|||
    },
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  if (embed.fields.length == 2) {
 | 
			
		||||
    // assumed created + images
 | 
			
		||||
    embed.fields[1].inline = false;
 | 
			
		||||
  } else if (embed.fields.length == 3) {
 | 
			
		||||
    // assumed created + clan + images
 | 
			
		||||
    embed.fields[2].inline = false;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return {embeds: [embed]};
 | 
			
		||||
};
 | 
			
		||||
hf.registerCommand(userinfo);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue