guildinfo: manual search term linebreaking

This commit is contained in:
Cynthia Foxwell 2024-08-19 21:56:26 -06:00
parent 8fa70aefa1
commit acd29ae5f5

View file

@ -90,6 +90,20 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
clan.wildcard_descriptors = clan.wildcard_descriptors.filter((x) => x != "");
const termLines = [];
let currentTerm = "";
for (const index in clan.search_terms) {
const term = clan.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 == clan.search_terms.length - 1) termLines.push(currentTerm);
}
clanEmbed = {
title: _guild != null ? "Clan data" : clan.name,
description: clan.description ?? "*No description*",
@ -116,9 +130,7 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
},
clan.search_terms.length > 0 && {
name: "Interests/Topics/Traits",
value: `${clan.search_terms
.map((term) => `\`\u2004${term.replaceAll(" ", "\u2009")}\u2004\``)
.join("\u2004")}`,
value: termLines.join("\n"),
inline: false,
},
games.length > 0 && {