This commit is contained in:
NoLogicAlan committed 2026-10-22 03:16:30 +03:00
1 parent 64e69275a4
commit e31c77e0d8
1 file changed
+22 -5
+22 -5
View File
@@ -419,17 +419,30 @@ function buildEmbed(t, msg, s, pending = []) {
]; ];
const authorOptions = { name: t(msg, "responses.stats.title") }; const authorOptions = { name: t(msg, "responses.stats.title") };
if (s.botIcon) authorOptions.iconURL = s.botIcon; if (typeof s.botIcon === "string" && s.botIcon.startsWith("http")) {
authorOptions.iconURL = s.botIcon;
}
const builder = new EmbedBuilder() const builder = new EmbedBuilder()
.setColor(getGlobalColor()) .setColor(getGlobalColor())
.setAuthor(authorOptions) .setAuthor(authorOptions)
.setDescription(descLines.join("\n")) .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) { if (fields.length > 0) {
builder.setThumbnail(s.botIcon); 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")) {
try { builder.setThumbnail(s.botIcon); } catch (_) {}
} }
if (typeof builder.setTimestamp === "function") builder.setTimestamp(); if (typeof builder.setTimestamp === "function") builder.setTimestamp();
@@ -453,7 +466,11 @@ 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; let botIcon = null;
try {
const raw = this.client?.user?.displayAvatarURL?.() || this.client?.user?.avatarURL?.();
if (typeof raw === "string" && raw.startsWith("http")) botIcon = raw;
} catch (_) {}
scheduleBackgroundRefresh(this.client, lastfmEnabled ? lastfm : null); scheduleBackgroundRefresh(this.client, lastfmEnabled ? lastfm : null);