guildinfo: manual search term linebreaking
This commit is contained in:
parent
8fa70aefa1
commit
acd29ae5f5
1 changed files with 15 additions and 3 deletions
|
@ -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 && {
|
||||
|
|
Loading…
Reference in a new issue