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