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", .map((asset) =>
value: assets asset.name.length > 32
.map((asset) => ? asset.name.substring(0, 31) + "\u2026"
asset.name.length > 32 : asset.name
? asset.name.substring(0, 31) + "\u2026" )
: asset.name .join(", ");
) if (assetList.length < 1024) {
.join(", "), embed.fields.push({
inline: false, name: `Assets (${assets.length})`,
}); value: assetList,
inline: false,
});
} else {
embed.fields.push({
name: `Assets (${assets.length})`,
value: "*Exceeds 1024 characters.*",
inline: false,
});
}
} }
} }