guildinfo: cleanup terms since discord keeps messing with inline code css

This commit is contained in:
Cynthia Foxwell 2025-06-21 11:09:53 -06:00
parent 0d5895e06a
commit 494e7dec0a
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -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 && {