lots of stuff noo need to say it lol

This commit is contained in:
NoLogicAlan committed 2026-05-09 15:37:50 +03:00
1 parent 7458df401e
commit 562092d127
1 file changed
+22 -8
+22 -8
View File
@@ -10,17 +10,25 @@ function embed(desc, opts = {}) {
return { embeds: [b] }; return { embeds: [b] };
} }
/** Build a rich embed with fields for the 24/7 status panel */ /** Build a rich embed with fields for the 24/7 status panel.
* Fluxer EmbedBuilder does not have addField() (that's discord.js).
* Instead, we build the base embed with EmbedBuilder, call .toJSON()
* to get the raw object, then attach a `fields` array directly.
*/
function richEmbed(fields, opts = {}) { function richEmbed(fields, opts = {}) {
const b = new EmbedBuilder().setColor(getGlobalColor()); const b = new EmbedBuilder().setColor(getGlobalColor());
if (opts.title) b.setTitle(opts.title); if (opts.title) b.setTitle(opts.title);
if (opts.description) b.setDescription(opts.description); if (opts.description) b.setDescription(opts.description);
if (opts.footer) b.setFooter({ text: opts.footer }); if (opts.footer) b.setFooter({ text: opts.footer });
if (opts.iconURL) b.setAuthor({ name: opts.title || "\u200b", iconURL: opts.iconURL }); if (opts.iconURL) b.setAuthor({ name: opts.title || "\u200b", iconURL: opts.iconURL });
for (const f of fields) { // EmbedBuilder doesn't have addField — use .toJSON() + raw fields
b.addField(f.name, f.value, f.inline ?? false); const raw = b.toJSON();
} raw.fields = fields.map(f => ({
return { embeds: [b] }; name: f.name,
value: f.value,
inline: f.inline ?? false,
}));
return { embeds: [raw] };
} }
// ── Constants ───────────────────────────────────────────────────────────────── // ── Constants ─────────────────────────────────────────────────────────────────
@@ -344,14 +352,20 @@ function build247EnabledPanel(set, channelId, mode, joined, ctx, guildId) {
? "1 channel saved" ? "1 channel saved"
: `${channels.length} channels saved`; : `${channels.length} channels saved`;
// Use the mode's color for the embed // Use the mode's color for the embed. EmbedBuilder doesn't have addField,
// so we build the base embed, .toJSON() it, then attach fields as a raw array.
const b = new EmbedBuilder(); const b = new EmbedBuilder();
b.setColor(modeColor(mode)); b.setColor(modeColor(mode));
b.setTitle(`♾️ 24/7 ${modeStr}`); b.setTitle(`♾️ 24/7 ${modeStr}`);
b.setDescription(`**${summary}** for this server`); b.setDescription(`**${summary}** for this server`);
b.setFooter({ text: `${prefix}247 off to disable for a channel` }); b.setFooter({ text: `${prefix}247 off to disable for a channel` });
for (const f of fields) b.addField(f.name, f.value, f.inline ?? false); const raw = b.toJSON();
return { embeds: [b] }; raw.fields = fields.map(f => ({
name: f.name,
value: f.value,
inline: f.inline ?? false,
}));
return { embeds: [raw] };
} }
/** /**