guildinfo: hate math

This commit is contained in:
Cynthia Foxwell 2025-04-18 10:56:44 -06:00
parent ee32491dc9
commit f119de0308
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -372,9 +372,9 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
if (features.length > 0) { if (features.length > 0) {
let featuresList = ""; let featuresList = "";
let firstFeature = true; let firstFeature = true;
for (const index in features) { for (let index = 0; index < features.length; index++) {
const feature = features[index]; const feature = features[index];
if (featuresList.length + feature.length + 1 > 1024 || index === features.length - 1) { if (featuresList.length + feature.length + 1 > 1024) {
embed.fields.push({ embed.fields.push({
name: firstFeature ? `Features (${features.length})` : "\u200b", name: firstFeature ? `Features (${features.length})` : "\u200b",
value: featuresList.trim(), value: featuresList.trim(),
@ -382,6 +382,19 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
}); });
featuresList = feature + "\n"; featuresList = feature + "\n";
if (firstFeature === true) firstFeature = false; if (firstFeature === true) firstFeature = false;
if (index === features.length - 1)
embed.fields.push({
name: firstFeature ? `Features (${features.length})` : "\u200b",
value: featuresList.trim(),
inline: true,
});
} else if (index === features.length - 1) {
featuresList = feature + "\n";
embed.fields.push({
name: firstFeature ? `Features (${features.length})` : "\u200b",
value: featuresList.trim(),
inline: true,
});
} else { } else {
featuresList += feature + "\n"; featuresList += feature + "\n";
} }