mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
feat(embeds): upgrade settings, 24/7 watchdog, and lastfm info embeds
- Upgrade %settings get to modular categorized Server Control Dashboard - Upgrade %247 panel to live voice watchdog and connection health monitor - Upgrade %fm profile to Last.fm music identity card with user avatar and stats - Upgrade %fm artistinfo to artist spotlight card with tags, bio, and plays matrix - Upgrade %fm cover to high-resolution album artwork gallery frame - Add complete translations across all 6 locales (0 missing keys)
This commit is contained in:
1 parent
63433816c4
commit
36b27d466b
11 files changed
+418
-332
No files matched your search
@@ -190,17 +190,43 @@ export async function runAccountActions(msg, data, lastfm, prefix, userId, targe
|
||||
|
||||
lastfm.syncUserScrobbleCount(profileUserId).catch(() => {});
|
||||
|
||||
const avatarUrl = info.image?.[3]?.["#text"] || info.image?.[2]?.["#text"] || null;
|
||||
const regDate = info.registered?.unixtime ? new Date(+info.registered.unixtime * 1000).toLocaleDateString() : "unknown";
|
||||
const scrobbleStatus = user.scrobbleEnabled
|
||||
? this.t(msg, "responses.lastfm.profileScrobbleEnabled")
|
||||
: this.t(msg, "responses.lastfm.profileScrobbleDisabled");
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(getGlobalColor())
|
||||
.setAuthor({ name: this.t(msg, "responses.lastfm.profileTitle", { username: info.name }), iconURL: info.image?.[2]?.["#text"] || undefined, url: info.url })
|
||||
.setDescription([
|
||||
this.t(msg, "responses.lastfm.profileScrobbles", { playcount: Utils.formatNumber(info.playcount ?? 0) }),
|
||||
this.t(msg, "responses.lastfm.profileRegistered", { date: info.registered?.unixtime ? new Date(+info.registered.unixtime * 1000).toLocaleDateString() : "unknown" }),
|
||||
this.t(msg, "responses.lastfm.profileScrobbleStatus", { status: user.scrobbleEnabled ? this.t(msg, "responses.lastfm.profileScrobbleEnabled") : this.t(msg, "responses.lastfm.profileScrobbleDisabled") }),
|
||||
``,
|
||||
this.t(msg, "responses.lastfm.profileLink", { url: info.url }),
|
||||
].join("\n"))
|
||||
.setFooter({ text: this.t(msg, "responses.lastfm.profileScrobbleFooter", { prefix }) });
|
||||
.setAuthor({ name: this.t(msg, "responses.lastfm.profileAuthor"), iconURL: avatarUrl || undefined, url: info.url })
|
||||
.setTitle(info.name)
|
||||
.setURL(info.url || undefined)
|
||||
.setDescription(
|
||||
`📅 **${this.t(msg, "responses.lastfm.profileFieldRegistered")}:** ${regDate}\n` +
|
||||
`🔗 **[${this.t(msg, "responses.lastfm.profileLink", { url: info.url })}](${info.url})**`
|
||||
)
|
||||
.addFields(
|
||||
{
|
||||
name: this.t(msg, "responses.lastfm.profileFieldTotalScrobbles"),
|
||||
value: `🎵 **${Utils.formatNumber(info.playcount ?? 0)}**`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: this.t(msg, "responses.lastfm.profileFieldArtists"),
|
||||
value: `🎤 **${Utils.formatNumber(info.artist_count ?? 0)}**`,
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: this.t(msg, "responses.lastfm.profileFieldScrobbling"),
|
||||
value: scrobbleStatus,
|
||||
inline: true
|
||||
}
|
||||
)
|
||||
.setFooter({ text: this.t(msg, "responses.lastfm.profileFooterPro", { prefix }) });
|
||||
|
||||
if (avatarUrl) {
|
||||
embed.setThumbnail(avatarUrl);
|
||||
}
|
||||
|
||||
return msg.reply({ embeds: [embed] });
|
||||
}
|
||||
|
||||
+28
-24
@@ -102,44 +102,46 @@ export async function runInfoActions(msg, data, lastfm, prefix, userId, targetUs
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(getGlobalColor())
|
||||
.setTitle(`🎤 ${info.name}`)
|
||||
.setAuthor({ name: this.t(msg, "responses.lastfm.artistSpotlightAuthor"), iconURL: info.image || undefined })
|
||||
.setTitle(info.name)
|
||||
.setURL(info.url || undefined)
|
||||
.setThumbnail(info.image || undefined);
|
||||
|
||||
let desc = "";
|
||||
if (info.tags?.length) {
|
||||
const tagStr = info.tags.slice(0, 6).map(t => {
|
||||
const tagLower = String(t).toLowerCase().replace(/\s+/g, "+");
|
||||
return `[\`${t}\`](https://www.last.fm/tag/${encodeURIComponent(tagLower)})`;
|
||||
}).join(" ");
|
||||
desc += tagStr + "\n\n";
|
||||
}
|
||||
if (info.bio) {
|
||||
const cleanBio = info.bio.replace(/<[^>]*>/g, "").trim();
|
||||
if (cleanBio.length > 0) {
|
||||
const truncated = cleanBio.length > 280 ? cleanBio.slice(0, 277) + "..." : cleanBio;
|
||||
desc += `> ${truncated}`;
|
||||
}
|
||||
}
|
||||
if (desc) embed.setDescription(desc.trim());
|
||||
|
||||
const fields = [];
|
||||
fields.push({ name: "Listeners", value: Utils.formatNumber(info.stats?.listeners ?? 0), inline: true });
|
||||
fields.push({ name: "Global Plays", value: Utils.formatNumber(info.stats?.playcount ?? 0), inline: true });
|
||||
fields.push({ name: this.t(msg, "responses.lastfm.artistFieldListeners"), value: `👥 **${Utils.formatNumber(info.stats?.listeners ?? 0)}**`, inline: true });
|
||||
fields.push({ name: this.t(msg, "responses.lastfm.artistFieldPlays"), value: `▶️ **${Utils.formatNumber(info.stats?.playcount ?? 0)}**`, inline: true });
|
||||
|
||||
if (info.userplaycount != null && user) {
|
||||
fields.push({ name: "Your Plays", value: Utils.formatNumber(info.userplaycount), inline: true });
|
||||
}
|
||||
|
||||
if (info.tags?.length) {
|
||||
const tagStr = info.tags.slice(0, 8).map(t => {
|
||||
const tagLower = String(t).toLowerCase().replace(/\s+/g, "+");
|
||||
return `[${t}](https://www.last.fm/tag/${encodeURIComponent(tagLower)})`;
|
||||
}).join(" · ");
|
||||
fields.push({ name: "Tags", value: tagStr, inline: false });
|
||||
fields.push({ name: this.t(msg, "responses.lastfm.artistFieldUserPlays"), value: `🎧 **${Utils.formatNumber(info.userplaycount)}**`, inline: true });
|
||||
}
|
||||
|
||||
if (info.similar?.length) {
|
||||
const simStr = info.similar.slice(0, 5).map(s => {
|
||||
return s.url ? `[${s.name}](${s.url})` : s.name;
|
||||
}).join(" · ");
|
||||
fields.push({ name: "Similar Artists", value: simStr, inline: false });
|
||||
fields.push({ name: this.t(msg, "responses.lastfm.artistFieldSimilar"), value: simStr, inline: false });
|
||||
}
|
||||
|
||||
embed.addFields(...fields);
|
||||
|
||||
if (info.bio) {
|
||||
const cleanBio = info.bio.replace(/<[^>]*>/g, "").trim();
|
||||
if (cleanBio.length > 0) {
|
||||
const truncated = cleanBio.length > 300 ? cleanBio.slice(0, 297) + "..." : cleanBio;
|
||||
embed.setDescription(truncated);
|
||||
}
|
||||
}
|
||||
|
||||
embed.setFooter({ text: user ? `Last.fm: ${user.username}` : "Last.fm" });
|
||||
embed.setFooter({ text: this.t(msg, "responses.lastfm.artistFooterPro", { artist: info.name }) });
|
||||
|
||||
return msg.reply({ embeds: [embed] });
|
||||
}
|
||||
@@ -494,9 +496,11 @@ export async function runInfoActions(msg, data, lastfm, prefix, userId, targetUs
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(getGlobalColor())
|
||||
.setTitle(this.t(msg, "responses.lastfm.coverTitle", { album: albumTitle }))
|
||||
.setAuthor({ name: this.t(msg, "responses.lastfm.coverAuthor") })
|
||||
.setTitle(albumTitle)
|
||||
.setDescription(`🎵 **${trackName}** ${String.fromCharCode(8212)} **${artistName}**`)
|
||||
.setImage(coverUrl)
|
||||
.setFooter({ text: this.t(msg, "responses.lastfm.coverFooter", { track: trackName, artist: artistName }) });
|
||||
.setFooter({ text: this.t(msg, "responses.lastfm.coverFooterPro", { prefix }) });
|
||||
|
||||
return msg.reply({ embeds: [embed] });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user