guildinfo: split features based on field size
This commit is contained in:
parent
ef39082d43
commit
2167ae4725
1 changed files with 18 additions and 11 deletions
|
@ -369,17 +369,24 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
|
||||||
|
|
||||||
const features = formatGuildFeatures(guild.features);
|
const features = formatGuildFeatures(guild.features);
|
||||||
|
|
||||||
|
if (features.length > 0) {
|
||||||
|
let featuresList = "";
|
||||||
|
let firstFeature = false;
|
||||||
|
for (const index in features) {
|
||||||
|
const feature = features[index];
|
||||||
|
if (featuresList.length + feature.length + 1 > 1024 || index === features.length - 1) {
|
||||||
embed.fields.push({
|
embed.fields.push({
|
||||||
name: `Features (${features.length})`,
|
name: firstFeature ? `Features (${features.length})` : "\u200b",
|
||||||
value: features.length > 0 ? features.slice(0, Math.ceil(features.length / 2)).join("\n") : "None",
|
value: featuresList.trim(),
|
||||||
inline: true,
|
|
||||||
});
|
|
||||||
if (features.length > 1)
|
|
||||||
embed.fields.push({
|
|
||||||
name: "\u200b",
|
|
||||||
value: features.slice(Math.ceil(features.length / 2), features.length).join("\n"),
|
|
||||||
inline: true,
|
inline: true,
|
||||||
});
|
});
|
||||||
|
featuresList = "";
|
||||||
|
if (!firstFeature) firstFeature = true;
|
||||||
|
} else {
|
||||||
|
featuresList += feature + "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const images = [];
|
const images = [];
|
||||||
if (guild.icon) {
|
if (guild.icon) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue