diff --git a/src/modules/utility/guildinfo.js b/src/modules/utility/guildinfo.js index 41cfc06..d08ed1a 100644 --- a/src/modules/utility/guildinfo.js +++ b/src/modules/utility/guildinfo.js @@ -97,35 +97,13 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) { if (profile.wildcard_descriptors) profile.wildcard_descriptors = profile.wildcard_descriptors.filter((x) => x != ""); - const termLines = []; - let currentTerm = ""; + let traits = ""; if (profile.search_terms) { - for (const index in profile.search_terms) { - 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); - } + traits = profile.search_terms.map((term) => `[\u2005${term}\u2005]`).join(" "); } else if (profile.traits) { - for (const index in profile.traits) { - const term = profile.traits[index]; - 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); - } + traits = profile.traits.map( + (term) => `[\u2005${term.emoji_name ? `:${term.emoji_name}: ` : ""}${term.label}\u2005]` + ); } 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, inline: true, }, - termLines.length > 0 && { + traits != "" && { name: "Traits", - value: termLines.join("\n"), + value: traits, inline: false, }, games.length > 0 && {