mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
style(stats)
This commit is contained in:
1 parent
3e30cdc6a3
commit
1e02478fb6
1 file changed
+20
-56
+20
-56
@@ -355,76 +355,51 @@ function buildEmbed(t, msg, s, pending = []) {
|
|||||||
})
|
})
|
||||||
: num(s.playerCount);
|
: num(s.playerCount);
|
||||||
|
|
||||||
const fields = [];
|
const sections = [
|
||||||
|
`### ${tOr(t, msg, "responses.stats.categoryOverview", "📊 Overview")}`,
|
||||||
const overviewParts = [
|
|
||||||
`${t(msg, "responses.stats.servers")} — ${field("guilds", num(s.guildCount))}`,
|
`${t(msg, "responses.stats.servers")} — ${field("guilds", num(s.guildCount))}`,
|
||||||
`${t(msg, "responses.stats.users")} — ${field("users", num(s.userCount))}`,
|
`${t(msg, "responses.stats.users")} — ${field("users", num(s.userCount))}`,
|
||||||
`${tOr(t, msg, "responses.stats.shard", "🧩 **Shard**")} — \`${s.shard}\``,
|
`${tOr(t, msg, "responses.stats.shard", "🧩 **Shard**")} — \`${s.shard}\``,
|
||||||
|
``,
|
||||||
];
|
];
|
||||||
fields.push({
|
|
||||||
name: tOr(t, msg, "responses.stats.categoryOverview", "📊 Overview"),
|
|
||||||
value: overviewParts.join(" • "),
|
|
||||||
inline: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const musicLines = [
|
const musicLines = [
|
||||||
|
`### ${tOr(t, msg, "responses.stats.categoryMusic", "🎧 Music Activity")}`,
|
||||||
`${t(msg, "responses.stats.players")} — ${field("players", playerVal)}`,
|
`${t(msg, "responses.stats.players")} — ${field("players", playerVal)}`,
|
||||||
];
|
];
|
||||||
const musicExtra = [];
|
|
||||||
if (s.queuedTracks > 0) {
|
if (s.queuedTracks > 0) {
|
||||||
musicExtra.push(`${tOr(t, msg, "responses.stats.queuedTracks", "🎶 **Queued Tracks**")} — ${field("queuedTracks", num(s.queuedTracks))}`);
|
musicLines.push(`${tOr(t, msg, "responses.stats.queuedTracks", "🎶 **Queued Tracks**")} — ${field("queuedTracks", num(s.queuedTracks))}`);
|
||||||
}
|
}
|
||||||
if (s.radios247 > 0) {
|
if (s.radios247 > 0) {
|
||||||
musicExtra.push(`${tOr(t, msg, "responses.stats.radios", "📻 **24/7 Radios**")} — ${field("radios", num(s.radios247))}`);
|
musicLines.push(`${tOr(t, msg, "responses.stats.radios", "📻 **24/7 Radios**")} — ${field("radios", num(s.radios247))}`);
|
||||||
}
|
}
|
||||||
if (musicExtra.length > 0) {
|
musicLines.push(``);
|
||||||
musicLines.push(musicExtra.join(" • "));
|
sections.push(...musicLines);
|
||||||
}
|
|
||||||
fields.push({
|
|
||||||
name: tOr(t, msg, "responses.stats.categoryMusic", "🎧 Music Activity"),
|
|
||||||
value: musicLines.join("\n"),
|
|
||||||
inline: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (s.lastfmEnabled) {
|
if (s.lastfmEnabled) {
|
||||||
const lastfmParts = [
|
sections.push(
|
||||||
|
`### ${tOr(t, msg, "responses.stats.categoryLastfm", "🎵 Last.fm")}`,
|
||||||
`${t(msg, "responses.stats.scrobbles")} — ${field("scrobbles", num(s.scrobbleCount))}`,
|
`${t(msg, "responses.stats.scrobbles")} — ${field("scrobbles", num(s.scrobbleCount))}`,
|
||||||
`${t(msg, "responses.stats.linkedUsers")} — ${field("linkedUsers", num(s.linkedUsers))}`,
|
`${t(msg, "responses.stats.linkedUsers")} — ${field("linkedUsers", num(s.linkedUsers))}`,
|
||||||
];
|
``,
|
||||||
fields.push({
|
);
|
||||||
name: tOr(t, msg, "responses.stats.categoryLastfm", "🎵 Last.fm"),
|
|
||||||
value: lastfmParts.join(" • "),
|
|
||||||
inline: false,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const latencyParts = [
|
const perfLines = [
|
||||||
|
`### ${tOr(t, msg, "responses.stats.categoryPerformance", "⚡ System & Network")}`,
|
||||||
`${t(msg, "responses.stats.ping")} — ${field("ping", `${num(s.ping)}ms`)}`,
|
`${t(msg, "responses.stats.ping")} — ${field("ping", `${num(s.ping)}ms`)}`,
|
||||||
];
|
];
|
||||||
if (s.gatewayPing >= 0) {
|
if (s.gatewayPing >= 0) {
|
||||||
latencyParts.push(`${tOr(t, msg, "responses.stats.gateway", GATEWAY_FALLBACK_LABEL)} — \`${num(s.gatewayPing)}ms\``);
|
perfLines.push(`${tOr(t, msg, "responses.stats.gateway", GATEWAY_FALLBACK_LABEL)} — \`${num(s.gatewayPing)}ms\``);
|
||||||
}
|
}
|
||||||
const perfLines = [
|
perfLines.push(`${t(msg, "responses.stats.uptime")} — \`${s.uptime}\``, ``);
|
||||||
latencyParts.join(" • "),
|
sections.push(...perfLines);
|
||||||
`${t(msg, "responses.stats.uptime")} — \`${s.uptime}\``,
|
|
||||||
];
|
|
||||||
fields.push({
|
|
||||||
name: tOr(t, msg, "responses.stats.categoryPerformance", "⚡ System & Network"),
|
|
||||||
value: perfLines.join("\n"),
|
|
||||||
inline: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const bottomLines = [
|
sections.push(
|
||||||
`${t(msg, "responses.stats.build")} — [\`${s.comHash}\`](${s.comLink})` +
|
`${t(msg, "responses.stats.build")} — [\`${s.comHash}\`](${s.comLink})` +
|
||||||
(s.reason ? ` • ${t(msg, "responses.stats.lastRestart")} — \`${s.reason}\`` : ""),
|
(s.reason ? ` • ${t(msg, "responses.stats.lastRestart")} — \`${s.reason}\`` : ""),
|
||||||
`${t(msg, "responses.stats.supportKofi")} • ${t(msg, "responses.stats.community")}`,
|
`${t(msg, "responses.stats.supportKofi")} • ${t(msg, "responses.stats.community")}`,
|
||||||
];
|
);
|
||||||
fields.push({
|
|
||||||
name: "\u200B",
|
|
||||||
value: bottomLines.join("\n"),
|
|
||||||
inline: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const authorOptions = { name: t(msg, "responses.stats.title") };
|
const authorOptions = { name: t(msg, "responses.stats.title") };
|
||||||
if (typeof s.botIcon === "string" && s.botIcon.startsWith("http")) {
|
if (typeof s.botIcon === "string" && s.botIcon.startsWith("http")) {
|
||||||
@@ -434,20 +409,9 @@ function buildEmbed(t, msg, s, pending = []) {
|
|||||||
const builder = new EmbedBuilder()
|
const builder = new EmbedBuilder()
|
||||||
.setColor(getGlobalColor())
|
.setColor(getGlobalColor())
|
||||||
.setAuthor(authorOptions)
|
.setAuthor(authorOptions)
|
||||||
|
.setDescription(sections.join("\n"))
|
||||||
.setFooter({ text: s.footer || t(msg, "responses.stats.title") });
|
.setFooter({ text: s.footer || t(msg, "responses.stats.title") });
|
||||||
|
|
||||||
if (fields.length > 0) {
|
|
||||||
try {
|
|
||||||
builder.addFields(...fields);
|
|
||||||
} catch (_) {
|
|
||||||
if (typeof builder.setFields === "function") {
|
|
||||||
try { builder.setFields(fields); } catch (__) { builder.data.fields = fields; }
|
|
||||||
} else {
|
|
||||||
builder.data.fields = fields;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof s.botIcon === "string" && s.botIcon.startsWith("http")) {
|
if (typeof s.botIcon === "string" && s.botIcon.startsWith("http")) {
|
||||||
try { builder.setThumbnail(s.botIcon); } catch (_) {}
|
try { builder.setThumbnail(s.botIcon); } catch (_) {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user