utility.appinfo: add count to assets and another 1024 check

This commit is contained in:
Cynthia Foxwell 2023-10-07 23:08:50 -06:00
parent 7a4fad8a37
commit de812f4210

View file

@ -1674,7 +1674,7 @@ appinfo.callback = async function (msg, line) {
if (left.length < 1024 && right.length < 1024) { if (left.length < 1024 && right.length < 1024) {
embed.fields.push({ embed.fields.push({
name: "Assets", name: `Assets (${assets.length})`,
value: left, value: left,
inline: true, inline: true,
}); });
@ -1685,17 +1685,26 @@ appinfo.callback = async function (msg, line) {
inline: true, inline: true,
}); });
} else { } else {
embed.fields.push({ const assetList = assets
name: "Assets",
value: assets
.map((asset) => .map((asset) =>
asset.name.length > 32 asset.name.length > 32
? asset.name.substring(0, 31) + "\u2026" ? asset.name.substring(0, 31) + "\u2026"
: asset.name : asset.name
) )
.join(", "), .join(", ");
if (assetList.length < 1024) {
embed.fields.push({
name: `Assets (${assets.length})`,
value: assetList,
inline: false, inline: false,
}); });
} else {
embed.fields.push({
name: `Assets (${assets.length})`,
value: "*Exceeds 1024 characters.*",
inline: false,
});
}
} }
} }