From de812f421076dbec7162e0516f9243ef2c9d0a57 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Sat, 7 Oct 2023 23:08:50 -0600 Subject: [PATCH] utility.appinfo: add count to assets and another 1024 check --- src/modules/utility.js | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/modules/utility.js b/src/modules/utility.js index e802932..b3bf6e6 100644 --- a/src/modules/utility.js +++ b/src/modules/utility.js @@ -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, + }); + } } }