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