guildinfo: cleanup terms since discord keeps messing with inline code css
This commit is contained in:
		
							parent
							
								
									0d5895e06a
								
							
						
					
					
						commit
						494e7dec0a
					
				
					 1 changed files with 7 additions and 29 deletions
				
			
		| 
						 | 
					@ -97,35 +97,13 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
 | 
				
			||||||
    if (profile.wildcard_descriptors)
 | 
					    if (profile.wildcard_descriptors)
 | 
				
			||||||
      profile.wildcard_descriptors = profile.wildcard_descriptors.filter((x) => x != "");
 | 
					      profile.wildcard_descriptors = profile.wildcard_descriptors.filter((x) => x != "");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const termLines = [];
 | 
					    let traits = "";
 | 
				
			||||||
    let currentTerm = "";
 | 
					 | 
				
			||||||
    if (profile.search_terms) {
 | 
					    if (profile.search_terms) {
 | 
				
			||||||
      for (const index in profile.search_terms) {
 | 
					      traits = profile.search_terms.map((term) => `[\u2005${term}\u2005]`).join(" ");
 | 
				
			||||||
        const term = profile.search_terms[index];
 | 
					 | 
				
			||||||
        const formattedTerm = `\`\u2004${term.replaceAll(" ", "\u2005")}\u2004\``;
 | 
					 | 
				
			||||||
        if (currentTerm.length + 1 + formattedTerm.length > 56) {
 | 
					 | 
				
			||||||
          termLines.push(currentTerm);
 | 
					 | 
				
			||||||
          currentTerm = formattedTerm;
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          currentTerm += "\u2004" + formattedTerm;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (index == profile.search_terms.length - 1) termLines.push(currentTerm);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    } else if (profile.traits) {
 | 
					    } else if (profile.traits) {
 | 
				
			||||||
      for (const index in profile.traits) {
 | 
					      traits = profile.traits.map(
 | 
				
			||||||
        const term = profile.traits[index];
 | 
					        (term) => `[\u2005${term.emoji_name ? `:${term.emoji_name}: ` : ""}${term.label}\u2005]`
 | 
				
			||||||
        const formattedTerm = `${term.emoji_name ? `:${term.emoji_name}:` : ""}\`\u2004${term.label.replaceAll(
 | 
					      );
 | 
				
			||||||
          " ",
 | 
					 | 
				
			||||||
          "\u2005"
 | 
					 | 
				
			||||||
        )}\u2004\``;
 | 
					 | 
				
			||||||
        if (currentTerm.length + 1 + formattedTerm.length > 56) {
 | 
					 | 
				
			||||||
          termLines.push(currentTerm);
 | 
					 | 
				
			||||||
          currentTerm = formattedTerm;
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          currentTerm += "\u2004" + formattedTerm;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        if (index == profile.traits.length - 1) termLines.push(currentTerm);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const gamesLeft = games.slice(0, Math.ceil(games.length / 2)).join("\n");
 | 
					    const gamesLeft = games.slice(0, Math.ceil(games.length / 2)).join("\n");
 | 
				
			||||||
| 
						 | 
					@ -149,9 +127,9 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
 | 
				
			||||||
          value: profile.member_count,
 | 
					          value: profile.member_count,
 | 
				
			||||||
          inline: true,
 | 
					          inline: true,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        termLines.length > 0 && {
 | 
					        traits != "" && {
 | 
				
			||||||
          name: "Traits",
 | 
					          name: "Traits",
 | 
				
			||||||
          value: termLines.join("\n"),
 | 
					          value: traits,
 | 
				
			||||||
          inline: false,
 | 
					          inline: false,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        games.length > 0 && {
 | 
					        games.length > 0 && {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue