guildinfo: fix long games in clans

This commit is contained in:
Cynthia Foxwell 2024-09-05 10:05:41 -06:00
parent 767d4256cf
commit 00c2d8f2a3

View file

@ -114,6 +114,16 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
if (index == clan.search_terms.length - 1) termLines.push(currentTerm);
}
let gameLines = "";
let gameLines2 = "";
for (const line of games) {
if (gameLines.length + line.length + 1 <= 1024) {
gameLines += line + "\n";
} else {
gameLines2 += line + "\n";
}
}
clanEmbed = {
color: parseInt(clan.brand_color_primary.replace("#", "0x")),
title: _guild == null ? clan.name : null,
@ -136,7 +146,12 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
},
games.length > 0 && {
name: "Associated Games",
value: `${games.join("\n")}`,
value: gameLines,
inline: false,
},
gameLines2 != "" && {
name: "\u200b",
value: gameLines,
inline: false,
},
{