mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
style(stats): overhaul embed into multi-column grid with bot thumbnail and localized categories
This commit is contained in:
1 parent
d6c233c311
commit
64e69275a4
8 files changed
+87
-20
No files matched your search
+63
-19
@@ -320,6 +320,8 @@ function tOr(t, msg, key, fallback, vars = {}) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the stats embed with all bot information.
|
* Build the stats embed with all bot information.
|
||||||
|
* Uses a clean multi-column grid layout (addFields) with category sections
|
||||||
|
* and a top-right bot avatar thumbnail.
|
||||||
* @private
|
* @private
|
||||||
* @param {Function} t - Translation function.
|
* @param {Function} t - Translation function.
|
||||||
* @param {object} msg - The command message wrapper.
|
* @param {object} msg - The command message wrapper.
|
||||||
@@ -331,6 +333,7 @@ function tOr(t, msg, key, fallback, vars = {}) {
|
|||||||
* @param {number} s.queuedTracks - Total tracks across all player queues.
|
* @param {number} s.queuedTracks - Total tracks across all player queues.
|
||||||
* @param {number} s.radios247 - Number of active 24/7 radio sessions.
|
* @param {number} s.radios247 - Number of active 24/7 radio sessions.
|
||||||
* @param {string} s.shard - Shard assignment string.
|
* @param {string} s.shard - Shard assignment string.
|
||||||
|
* @param {string|null} [s.botIcon] - Bot avatar URL.
|
||||||
* @param {number} s.scrobbleCount - Total Last.fm scrobbles.
|
* @param {number} s.scrobbleCount - Total Last.fm scrobbles.
|
||||||
* @param {number} s.linkedUsers - Number of Last.fm linked users.
|
* @param {number} s.linkedUsers - Number of Last.fm linked users.
|
||||||
* @param {number} s.ping - Bot response ping in ms (REST reply round trip).
|
* @param {number} s.ping - Bot response ping in ms (REST reply round trip).
|
||||||
@@ -355,41 +358,80 @@ function buildEmbed(t, msg, s, pending = []) {
|
|||||||
})
|
})
|
||||||
: num(s.playerCount);
|
: num(s.playerCount);
|
||||||
|
|
||||||
const description = [
|
const fields = [];
|
||||||
|
|
||||||
|
const overviewLines = [
|
||||||
`${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))}`,
|
||||||
`${t(msg, "responses.stats.players")} — ${field("players", playerVal)}`,
|
`${tOr(t, msg, "responses.stats.shard", "🧩 **Shard**")} — \`${s.shard}\``,
|
||||||
`${tOr(t, msg, "responses.stats.queuedTracks", "🎶 **Queued Tracks**")} — ${field("queuedTracks", num(s.queuedTracks))}`,
|
|
||||||
s.radios247 > 0 ? `${tOr(t, msg, "responses.stats.radios", "📻 **24/7 Radios**")} — ${field("radios", num(s.radios247))}` : null,
|
|
||||||
];
|
];
|
||||||
|
fields.push({
|
||||||
|
name: tOr(t, msg, "responses.stats.categoryOverview", "📊 Overview"),
|
||||||
|
value: overviewLines.join("\n"),
|
||||||
|
inline: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const musicLines = [
|
||||||
|
`${t(msg, "responses.stats.players")} — ${field("players", playerVal)}`,
|
||||||
|
];
|
||||||
|
if (s.queuedTracks > 0) {
|
||||||
|
musicLines.push(`${tOr(t, msg, "responses.stats.queuedTracks", "🎶 **Queued Tracks**")} — ${field("queuedTracks", num(s.queuedTracks))}`);
|
||||||
|
}
|
||||||
|
if (s.radios247 > 0) {
|
||||||
|
musicLines.push(`${tOr(t, msg, "responses.stats.radios", "📻 **24/7 Radios**")} — ${field("radios", num(s.radios247))}`);
|
||||||
|
}
|
||||||
|
fields.push({
|
||||||
|
name: tOr(t, msg, "responses.stats.categoryMusic", "🎧 Music Activity"),
|
||||||
|
value: musicLines.join("\n"),
|
||||||
|
inline: true,
|
||||||
|
});
|
||||||
|
|
||||||
if (s.lastfmEnabled) {
|
if (s.lastfmEnabled) {
|
||||||
description.push(
|
const lastfmLines = [
|
||||||
`${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: lastfmLines.join("\n"),
|
||||||
|
inline: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
description.push(
|
const perfLines = [
|
||||||
`${t(msg, "responses.stats.ping")} — ${field("ping", `${num(s.ping)}ms`)}`,
|
`${t(msg, "responses.stats.ping")} — ${field("ping", `${num(s.ping)}ms`)}`,
|
||||||
s.gatewayPing >= 0 ? `${tOr(t, msg, "responses.stats.gateway", GATEWAY_FALLBACK_LABEL)} — \`${num(s.gatewayPing)}ms\`` : null,
|
];
|
||||||
`${tOr(t, msg, "responses.stats.shard", "🧩 **Shard**")} — \`${s.shard}\``,
|
if (s.gatewayPing >= 0) {
|
||||||
`${t(msg, "responses.stats.uptime")} — \`${s.uptime}\``,
|
perfLines.push(`${tOr(t, msg, "responses.stats.gateway", GATEWAY_FALLBACK_LABEL)} — \`${num(s.gatewayPing)}ms\``);
|
||||||
`${t(msg, "responses.stats.build")} — [\`${s.comHash}\`](${s.comLink})`,
|
}
|
||||||
s.reason ? `${t(msg, "responses.stats.lastRestart")} — \`${s.reason}\`` : null,
|
perfLines.push(`${t(msg, "responses.stats.uptime")} — \`${s.uptime}\``);
|
||||||
``,
|
fields.push({
|
||||||
t(msg, "responses.stats.supportKofi"),
|
name: tOr(t, msg, "responses.stats.categoryPerformance", "⚡ System & Network"),
|
||||||
t(msg, "responses.stats.community"),
|
value: perfLines.join("\n"),
|
||||||
);
|
inline: true,
|
||||||
|
});
|
||||||
|
|
||||||
const desc = description.filter(l => l !== null).join("\n");
|
const descLines = [
|
||||||
|
`${t(msg, "responses.stats.build")} — [\`${s.comHash}\`](${s.comLink})` +
|
||||||
|
(s.reason ? ` • ${t(msg, "responses.stats.lastRestart")} — \`${s.reason}\`` : ""),
|
||||||
|
``,
|
||||||
|
`${t(msg, "responses.stats.supportKofi")} • ${t(msg, "responses.stats.community")}`,
|
||||||
|
];
|
||||||
|
|
||||||
|
const authorOptions = { name: t(msg, "responses.stats.title") };
|
||||||
|
if (s.botIcon) authorOptions.iconURL = s.botIcon;
|
||||||
|
|
||||||
const builder = new EmbedBuilder()
|
const builder = new EmbedBuilder()
|
||||||
.setColor(getGlobalColor())
|
.setColor(getGlobalColor())
|
||||||
.setAuthor({ name: t(msg, "responses.stats.title") })
|
.setAuthor(authorOptions)
|
||||||
.setDescription(desc)
|
.setDescription(descLines.join("\n"))
|
||||||
|
.addFields(fields)
|
||||||
.setFooter({ text: s.footer || t(msg, "responses.stats.title") });
|
.setFooter({ text: s.footer || t(msg, "responses.stats.title") });
|
||||||
|
|
||||||
|
if (s.botIcon) {
|
||||||
|
builder.setThumbnail(s.botIcon);
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof builder.setTimestamp === "function") builder.setTimestamp();
|
if (typeof builder.setTimestamp === "function") builder.setTimestamp();
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
@@ -411,6 +453,7 @@ export async function run(message) {
|
|||||||
const totals = getTotals(this.client);
|
const totals = getTotals(this.client);
|
||||||
const music = getMusicStats(this.players?.playerMap);
|
const music = getMusicStats(this.players?.playerMap);
|
||||||
const shard = getShardInfo(this.client, message.guildId ?? message.guild?.id);
|
const shard = getShardInfo(this.client, message.guildId ?? message.guild?.id);
|
||||||
|
const botIcon = this.client?.user?.displayAvatarURL?.() || this.client?.user?.avatarURL?.() || null;
|
||||||
|
|
||||||
scheduleBackgroundRefresh(this.client, lastfmEnabled ? lastfm : null);
|
scheduleBackgroundRefresh(this.client, lastfmEnabled ? lastfm : null);
|
||||||
|
|
||||||
@@ -430,6 +473,7 @@ export async function run(message) {
|
|||||||
queuedTracks: music.queuedTracks,
|
queuedTracks: music.queuedTracks,
|
||||||
radios247: music.radios247,
|
radios247: music.radios247,
|
||||||
shard,
|
shard,
|
||||||
|
botIcon,
|
||||||
scrobbleCount: lastfmEnabled ? (cache.scrobbles ?? 0) : 0,
|
scrobbleCount: lastfmEnabled ? (cache.scrobbles ?? 0) : 0,
|
||||||
linkedUsers: lastfmEnabled ? (cache.linkedUsers ?? 0) : 0,
|
linkedUsers: lastfmEnabled ? (cache.linkedUsers ?? 0) : 0,
|
||||||
lastfmEnabled,
|
lastfmEnabled,
|
||||||
|
|||||||
@@ -516,7 +516,6 @@ class Player extends EventEmitter {
|
|||||||
this._lastConnectedAt = Date.now();
|
this._lastConnectedAt = Date.now();
|
||||||
this.leaving = false;
|
this.leaving = false;
|
||||||
|
|
||||||
// Fail-fast permission check before initiating gateway voice handshake
|
|
||||||
try {
|
try {
|
||||||
const me = channel.guild?.members?.me ?? (this.client?.user?.id ? channel.guild?.members?.get?.(this.client.user.id) : null);
|
const me = channel.guild?.members?.me ?? (this.client?.user?.id ? channel.guild?.members?.get?.(this.client.user.id) : null);
|
||||||
if (me) {
|
if (me) {
|
||||||
|
|||||||
@@ -611,6 +611,10 @@
|
|||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"title": "بوت Remix الموسيقي",
|
"title": "بوت Remix الموسيقي",
|
||||||
|
"categoryOverview": "📊 نظرة عامة",
|
||||||
|
"categoryMusic": "🎧 النشاط الموسيقي",
|
||||||
|
"categoryLastfm": "🎵 Last.fm",
|
||||||
|
"categoryPerformance": "⚡ النظام والشبكة",
|
||||||
"servers": "📂 **الخوادم**",
|
"servers": "📂 **الخوادم**",
|
||||||
"users": "👥 **المستخدمون**",
|
"users": "👥 **المستخدمون**",
|
||||||
"players": "🎧 **المشغّلات**",
|
"players": "🎧 **المشغّلات**",
|
||||||
|
|||||||
@@ -611,6 +611,10 @@
|
|||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"title": "بۆتی موزیکی Remix",
|
"title": "بۆتی موزیکی Remix",
|
||||||
|
"categoryOverview": "📊 کورتە",
|
||||||
|
"categoryMusic": "🎧 چالاکی موزیک",
|
||||||
|
"categoryLastfm": "🎵 Last.fm",
|
||||||
|
"categoryPerformance": "⚡ سیستەم و هێڵ",
|
||||||
"servers": "📂 **سێرڤەرەکان**",
|
"servers": "📂 **سێرڤەرەکان**",
|
||||||
"users": "👥 **بەکارهێنەران**",
|
"users": "👥 **بەکارهێنەران**",
|
||||||
"players": "🎧 **پەخشکەرەکان**",
|
"players": "🎧 **پەخشکەرەکان**",
|
||||||
|
|||||||
@@ -611,6 +611,10 @@
|
|||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"title": "Remix Musik-Bot",
|
"title": "Remix Musik-Bot",
|
||||||
|
"categoryOverview": "📊 Übersicht",
|
||||||
|
"categoryMusic": "🎧 Musik-Aktivität",
|
||||||
|
"categoryLastfm": "🎵 Last.fm",
|
||||||
|
"categoryPerformance": "⚡ System & Netzwerk",
|
||||||
"servers": "📂 **Server**",
|
"servers": "📂 **Server**",
|
||||||
"users": "👥 **Benutzer**",
|
"users": "👥 **Benutzer**",
|
||||||
"players": "🎧 **Player**",
|
"players": "🎧 **Player**",
|
||||||
|
|||||||
@@ -728,6 +728,10 @@
|
|||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"title": "Remix Music Bot",
|
"title": "Remix Music Bot",
|
||||||
|
"categoryOverview": "📊 Overview",
|
||||||
|
"categoryMusic": "🎧 Music Activity",
|
||||||
|
"categoryLastfm": "🎵 Last.fm",
|
||||||
|
"categoryPerformance": "⚡ System & Network",
|
||||||
"servers": "📂 **Servers**",
|
"servers": "📂 **Servers**",
|
||||||
"users": "👥 **Users**",
|
"users": "👥 **Users**",
|
||||||
"players": "🎧 **Players**",
|
"players": "🎧 **Players**",
|
||||||
|
|||||||
@@ -611,6 +611,10 @@
|
|||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"title": "Bot de Música Remix",
|
"title": "Bot de Música Remix",
|
||||||
|
"categoryOverview": "📊 Visão Geral",
|
||||||
|
"categoryMusic": "🎧 Atividade Musical",
|
||||||
|
"categoryLastfm": "🎵 Last.fm",
|
||||||
|
"categoryPerformance": "⚡ Sistema e Rede",
|
||||||
"servers": "📂 **Servidores**",
|
"servers": "📂 **Servidores**",
|
||||||
"users": "👥 **Usuários**",
|
"users": "👥 **Usuários**",
|
||||||
"players": "🎧 **Players**",
|
"players": "🎧 **Players**",
|
||||||
|
|||||||
@@ -717,6 +717,10 @@
|
|||||||
},
|
},
|
||||||
"stats": {
|
"stats": {
|
||||||
"title": "Remix Müzik Botu",
|
"title": "Remix Müzik Botu",
|
||||||
|
"categoryOverview": "📊 Genel Bakış",
|
||||||
|
"categoryMusic": "🎧 Müzik Aktivitesi",
|
||||||
|
"categoryLastfm": "🎵 Last.fm",
|
||||||
|
"categoryPerformance": "⚡ Sistem ve Ağ",
|
||||||
"servers": "📂 **Sunucular**",
|
"servers": "📂 **Sunucular**",
|
||||||
"users": "👥 **Kullanıcılar**",
|
"users": "👥 **Kullanıcılar**",
|
||||||
"players": "🎧 **Oynatıcılar**",
|
"players": "🎧 **Oynatıcılar**",
|
||||||
|
|||||||
Reference in new issue
Block a user