mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
feat(music): fully localize now-playing embeds, footers, and source platforms
This commit is contained in:
1 parent
53e3a7e4de
commit
b7f20fcb02
7 files changed
+187
-33
No files matched your search
@@ -179,29 +179,35 @@ const DisplayMixin = {
|
||||
|
||||
const vcLine = this._channelId ? `🔊 <#${this._channelId}>\n` : "";
|
||||
|
||||
let sourceName = "Music";
|
||||
let sourceName = this._t("responses.play.sourceMusic");
|
||||
let sourceIcon = "🎵";
|
||||
const sourceColor = 0xe9196c;
|
||||
|
||||
if (current.type === "radio") {
|
||||
sourceName = "24/7 Radio";
|
||||
sourceName = this._t("responses.play.sourceRadio");
|
||||
sourceIcon = "📻";
|
||||
} else if (current.spotifyUrl || current.type === "spotify") {
|
||||
sourceName = "Spotify";
|
||||
sourceName = this._t("responses.play.sourceSpotify");
|
||||
sourceIcon = "🟢";
|
||||
} else if (current.type === "soundcloud" || current.url?.includes("soundcloud.com")) {
|
||||
sourceName = "SoundCloud";
|
||||
sourceName = this._t("responses.play.sourceSoundcloud");
|
||||
sourceIcon = "🟠";
|
||||
} else if (current.type === "youtube" || current.url?.includes("youtube.com") || current.url?.includes("youtu.be")) {
|
||||
sourceName = "YouTube";
|
||||
sourceName = this._t("responses.play.sourceYoutube");
|
||||
sourceIcon = "▶️";
|
||||
}
|
||||
|
||||
const trackUrl = current.spotifyUrl || current.url || null;
|
||||
const rawAuthor = current.artist || (typeof current.author === "object" ? current.author?.name : current.author);
|
||||
const artistName = rawAuthor || "Unknown";
|
||||
const loopState = this.queue.songLoop ? "🔂 Song" : this.queue.loop ? "🔄 Queue" : "Off";
|
||||
const nextTrack = this.queue.data?.[0]?.title ? Utils.truncate(this.queue.data[0].title, 35) : "End of queue";
|
||||
const artistName = rawAuthor || this._t("responses.play.unknownAuthor");
|
||||
const loopState = this.queue.songLoop
|
||||
? `🔂 ${this._t("responses.play.loopSongLabel")}`
|
||||
: this.queue.loop
|
||||
? `🔄 ${this._t("responses.play.loopQueueLabel")}`
|
||||
: this._t("responses.play.loopOffLabel");
|
||||
const nextTrack = this.queue.data?.[0]?.title
|
||||
? Utils.truncate(this.queue.data[0].title, 35)
|
||||
: this._t("responses.play.endOfQueue");
|
||||
const queueCount = this.queue.size();
|
||||
const queueRemaining = this.getQueueRemainingTime();
|
||||
|
||||
@@ -235,10 +241,10 @@ const DisplayMixin = {
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(sourceColor)
|
||||
.setAuthor({
|
||||
name: `${sourceIcon} Now Playing • ${sourceName}`,
|
||||
name: `${sourceIcon} ${this._t("responses.play.autoNowPlaying")} • ${sourceName}`,
|
||||
url: trackUrl || undefined,
|
||||
})
|
||||
.setTitle(Utils.truncate(current.title || "Unknown Track", 250))
|
||||
.setTitle(Utils.truncate(current.title || this._t("responses.play.unknownTrack"), 250))
|
||||
.setURL(trackUrl || undefined);
|
||||
|
||||
if (current.thumbnail) {
|
||||
@@ -247,31 +253,32 @@ const DisplayMixin = {
|
||||
|
||||
if (current.type === "radio") {
|
||||
let desc = current.description ? `${current.description}\n\n` : "";
|
||||
desc += `🎵 **Live Broadcast:** ${radioLiveTitle || "Live Stream"}`;
|
||||
desc += `🎵 **${this._t("responses.play.liveBroadcast")}:** ${radioLiveTitle || this._t("responses.play.sourceRadio")}`;
|
||||
embed.setDescription(desc);
|
||||
embed.addFields(
|
||||
{ name: "📻 Station", value: Utils.truncate(current.title, 40), inline: true },
|
||||
{ name: "🎧 Channel", value: this._channelId ? `<#${this._channelId}>` : "None", inline: true },
|
||||
{ name: "🔊 Volume", value: vol, inline: true }
|
||||
{ name: `📻 ${this._t("responses.play.station")}`, value: Utils.truncate(current.title || this._t("responses.play.sourceRadio"), 40), inline: true },
|
||||
{ name: `🎧 ${this._t("responses.play.channel")}`, value: this._channelId ? `<#${this._channelId}>` : this._t("responses.play.none"), inline: true },
|
||||
{ name: `🔊 ${this._t("responses.play.volume")}`, value: vol, inline: true }
|
||||
);
|
||||
} else {
|
||||
let desc = `${this._createProgressBar(20)}`;
|
||||
if (this._activeTrackOpt) {
|
||||
const optStart = Utils.prettifyMS(this._activeTrackOpt.startMs);
|
||||
const optEnd = this._activeTrackOpt.endMs > 0 ? Utils.prettifyMS(this._activeTrackOpt.endMs) : "end";
|
||||
desc += `\n✂️ Custom Cut: \`${optStart} → ${optEnd}\``;
|
||||
desc += `\n✂️ ${this._t("responses.play.customCut")}: \`${optStart} → ${optEnd}\``;
|
||||
}
|
||||
embed.setDescription(desc);
|
||||
embed.addFields(
|
||||
{ name: "👤 Artist", value: Utils.truncate(artistName, 40), inline: true },
|
||||
{ name: "🎧 Channel", value: this._channelId ? `<#${this._channelId}>` : "None", inline: true },
|
||||
{ name: "⚙️ Mode / Vol", value: `${loopState} • ${vol}`, inline: true }
|
||||
{ name: `👤 ${this._t("responses.play.artist")}`, value: Utils.truncate(artistName, 40), inline: true },
|
||||
{ name: `🎧 ${this._t("responses.play.channel")}`, value: this._channelId ? `<#${this._channelId}>` : this._t("responses.play.none"), inline: true },
|
||||
{ name: `⚙️ ${this._t("responses.play.modeVol")}`, value: `${loopState} • ${vol}`, inline: true }
|
||||
);
|
||||
}
|
||||
|
||||
const pluralStr = queueCount === 1 ? this._t("responses.play.trackSingle") : this._t("responses.play.trackPlural");
|
||||
const footerText = queueCount > 0
|
||||
? `Queue: ${queueCount} ${queueCount === 1 ? "track" : "tracks"} (${queueRemaining}) • Next: ${nextTrack}`
|
||||
: `Queue: Empty • Autoplay: ${this._autoplay ? "On" : "Off"}`;
|
||||
? this._t("responses.play.nowPlayingFooter", { count: queueCount, plural: pluralStr, remaining: queueRemaining, next: nextTrack })
|
||||
: this._t("responses.play.nowPlayingFooterEmpty", { autoplay: this._autoplay ? this._t("responses.play.on") : this._t("responses.play.off") });
|
||||
|
||||
embed.setFooter({ text: footerText });
|
||||
if (typeof embed.setTimestamp === "function") embed.setTimestamp();
|
||||
@@ -328,7 +335,7 @@ const DisplayMixin = {
|
||||
*/
|
||||
buildAddedToQueueEmbed(video, top = false, requester = null) {
|
||||
const rawAuthor = video.artist || (typeof video.author === "object" ? video.author?.name : video.author);
|
||||
const author = rawAuthor || "Unknown";
|
||||
const author = rawAuthor || this._t("responses.play.unknownAuthor");
|
||||
const trackUrl = video.spotifyUrl || video.url || null;
|
||||
const durationStr = this.getDuration(video.duration);
|
||||
|
||||
@@ -365,7 +372,7 @@ const DisplayMixin = {
|
||||
name: `➕ ${this._t("responses.play.addedToQueue")}`,
|
||||
url: trackUrl || undefined
|
||||
})
|
||||
.setTitle(Utils.truncate(video.title || "Unknown Track", 250))
|
||||
.setTitle(Utils.truncate(video.title || this._t("responses.play.unknownTrack"), 250))
|
||||
.setURL(trackUrl || undefined);
|
||||
|
||||
if (video.thumbnail) {
|
||||
@@ -406,9 +413,9 @@ const DisplayMixin = {
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xe9196c)
|
||||
.setAuthor({ name: `📻 ${this._t("responses.play.autoNowPlaying")}` })
|
||||
.setTitle(Utils.truncate(s.title || "24/7 Radio", 250))
|
||||
.setTitle(Utils.truncate(s.title || this._t("responses.play.sourceRadio"), 250))
|
||||
.setURL(s.author?.url || s.url || undefined)
|
||||
.setDescription(`🎵 **${s.description || "Live Broadcast"}**\n\n🔊 <#${this._channelId}>`)
|
||||
.setDescription(`🎵 **${s.description || this._t("responses.play.liveBroadcast")}**\n\n🔊 <#${this._channelId}>`)
|
||||
.setFooter({ text: this._t("responses.play.controlsHint", { prefix }) });
|
||||
if (s.thumbnail) embed.setThumbnail(s.thumbnail);
|
||||
this.emit("message", { embeds: [embed] });
|
||||
@@ -416,18 +423,27 @@ const DisplayMixin = {
|
||||
}
|
||||
|
||||
const rawAuthor = s.artist || (typeof s.author === "object" ? s.author?.name : s.author);
|
||||
const author = rawAuthor || "Unknown";
|
||||
const author = rawAuthor || this._t("responses.play.unknownAuthor");
|
||||
const trackUrl = s.spotifyUrl || s.url || null;
|
||||
const durationStr = this.getDuration(s.duration);
|
||||
const nextTrack = this.queue.data?.[0]?.title ? Utils.truncate(this.queue.data[0].title, 35) : null;
|
||||
|
||||
let sourceIcon = "🎵";
|
||||
if (s.spotifyUrl || s.type === "spotify") {
|
||||
sourceIcon = "🟢";
|
||||
} else if (s.type === "soundcloud" || s.url?.includes("soundcloud.com")) {
|
||||
sourceIcon = "🟠";
|
||||
} else if (s.type === "youtube" || s.url?.includes("youtube.com") || s.url?.includes("youtu.be")) {
|
||||
sourceIcon = "▶️";
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0xe9196c)
|
||||
.setAuthor({
|
||||
name: `🟢 ${this._t("responses.play.autoNowPlaying")}`,
|
||||
name: `${sourceIcon} ${this._t("responses.play.autoNowPlaying")}`,
|
||||
url: trackUrl || undefined
|
||||
})
|
||||
.setTitle(Utils.truncate(s.title || "Unknown Track", 250))
|
||||
.setTitle(Utils.truncate(s.title || this._t("responses.play.unknownTrack"), 250))
|
||||
.setURL(trackUrl || undefined);
|
||||
|
||||
if (s.thumbnail) {
|
||||
|
||||
@@ -420,7 +420,30 @@
|
||||
"bilibiliResolving": "📺 جارٍ تحليل فيديو Bilibili...",
|
||||
"bilibiliNoAudio": "❌ لا يوجد صوت قابل للتشغيل لـ **{{title}}** — قد يكون الفيديو مقفلًا جغرافيًا أو مدفوعًا أو محذوفًا.",
|
||||
"bilibiliError": "❌ Bilibili: {{message}}",
|
||||
"bilibiliDisabled": "❌ تشغيل Bilibili معطل (config.json → bilibili.enabled)."
|
||||
"bilibiliDisabled": "❌ تشغيل Bilibili معطل (config.json → bilibili.enabled).",
|
||||
"sourceRadio": "راديو 24/7",
|
||||
"sourceMusic": "موسيقى",
|
||||
"station": "المحطة",
|
||||
"channel": "القناة",
|
||||
"artist": "الفنان",
|
||||
"modeVol": "الوضع / الصوت",
|
||||
"volume": "مستوى الصوت",
|
||||
"liveBroadcast": "بث مباشر",
|
||||
"customCut": "قص مخصص",
|
||||
"unknownAuthor": "فنان غير معروف",
|
||||
"unknownTrack": "مقطع غير معروف",
|
||||
"endOfQueue": "نهاية القائمة",
|
||||
"none": "لا يوجد",
|
||||
"on": "مفعّل",
|
||||
"off": "معطّل",
|
||||
"nowPlayingFooter": "القائمة: {{count}} {{plural}} ({{remaining}}) • التالي: {{next}}",
|
||||
"nowPlayingFooterEmpty": "القائمة: فارغة • التشغيل التلقائي: {{autoplay}}",
|
||||
"loopSongLabel": "المقطع",
|
||||
"loopQueueLabel": "القائمة",
|
||||
"loopOffLabel": "معطّل",
|
||||
"sourceSpotify": "سبوتيفاي",
|
||||
"sourceSoundcloud": "ساوندكلاود",
|
||||
"sourceYoutube": "يوتيوب"
|
||||
},
|
||||
"playnext": {
|
||||
"searching": "🔍 جارٍ البحث..."
|
||||
|
||||
@@ -420,7 +420,30 @@
|
||||
"bilibiliResolving": "📺 ڤیدیۆی Bilibili چارەسەر دەکرێت...",
|
||||
"bilibiliNoAudio": "❌ هیچ دەنگێکی لێدراو نییە بۆ **{{title}}** — لەوانەیە ڤیدیۆکە بە ناوچە دەبەسترێت، پارەدار بێت یان سڕدرابێتەوە.",
|
||||
"bilibiliError": "❌ Bilibili: {{message}}",
|
||||
"bilibiliDisabled": "❌ لێدانی Bilibili ناچالاک کراوە (config.json → bilibili.enabled)."
|
||||
"bilibiliDisabled": "❌ لێدانی Bilibili ناچالاک کراوە (config.json → bilibili.enabled).",
|
||||
"sourceRadio": "ڕادیۆی ٢٤/٧",
|
||||
"sourceMusic": "مۆسیقا",
|
||||
"station": "وێستگە",
|
||||
"channel": "کەناڵ",
|
||||
"artist": "هونەرمەند",
|
||||
"modeVol": "دۆخ / دەنگ",
|
||||
"volume": "دەنگ",
|
||||
"liveBroadcast": "پەخشی ڕاستەوخۆ",
|
||||
"customCut": "بڕینی تایبەت",
|
||||
"unknownAuthor": "هونەرمەندی نەناسراو",
|
||||
"unknownTrack": "تراکی نەناسراو",
|
||||
"endOfQueue": "کۆتایی ڕیزبەندی",
|
||||
"none": "هیچ",
|
||||
"on": "چالاکە",
|
||||
"off": "ناچالاکە",
|
||||
"nowPlayingFooter": "ڕیزبەندی: {{count}} {{plural}} ({{remaining}}) • دواتر: {{next}}",
|
||||
"nowPlayingFooterEmpty": "ڕیزبەندی: بەتاڵە • پەخشی خۆکار: {{autoplay}}",
|
||||
"loopSongLabel": "گۆرانی",
|
||||
"loopQueueLabel": "ڕیزبەندی",
|
||||
"loopOffLabel": "ناچالاکە",
|
||||
"sourceSpotify": "سپۆتیفای",
|
||||
"sourceSoundcloud": "ساوندکلاود",
|
||||
"sourceYoutube": "یوتیوب"
|
||||
},
|
||||
"playnext": {
|
||||
"searching": "🔍 گەڕان..."
|
||||
|
||||
@@ -420,7 +420,30 @@
|
||||
"bilibiliResolving": "📺 Bilibili-Video wird aufgelöst...",
|
||||
"bilibiliNoAudio": "❌ Kein abspielbares Audio für **{{title}}** — das Video ist möglicherweise regional gesperrt, kostenpflichtig oder gelöscht.",
|
||||
"bilibiliError": "❌ Bilibili: {{message}}",
|
||||
"bilibiliDisabled": "❌ Bilibili-Wiedergabe ist deaktiviert (config.json → bilibili.enabled)."
|
||||
"bilibiliDisabled": "❌ Bilibili-Wiedergabe ist deaktiviert (config.json → bilibili.enabled).",
|
||||
"sourceRadio": "24/7 Radio",
|
||||
"sourceMusic": "Musik",
|
||||
"station": "Sender",
|
||||
"channel": "Kanal",
|
||||
"artist": "Künstler",
|
||||
"modeVol": "Modus / Lautstärke",
|
||||
"volume": "Lautstärke",
|
||||
"liveBroadcast": "Live-Übertragung",
|
||||
"customCut": "Benutzerdefinierter Schnitt",
|
||||
"unknownAuthor": "Unbekannter Künstler",
|
||||
"unknownTrack": "Unbekannter Track",
|
||||
"endOfQueue": "Ende der Warteschlange",
|
||||
"none": "Keine",
|
||||
"on": "Ein",
|
||||
"off": "Aus",
|
||||
"nowPlayingFooter": "Warteschlange: {{count}} {{plural}} ({{remaining}}) • Weiter: {{next}}",
|
||||
"nowPlayingFooterEmpty": "Warteschlange: Leer • Autoplay: {{autoplay}}",
|
||||
"loopSongLabel": "Track",
|
||||
"loopQueueLabel": "Warteschlange",
|
||||
"loopOffLabel": "Aus",
|
||||
"sourceSpotify": "Spotify",
|
||||
"sourceSoundcloud": "SoundCloud",
|
||||
"sourceYoutube": "YouTube"
|
||||
},
|
||||
"playnext": {
|
||||
"searching": "🔍 Suche..."
|
||||
|
||||
@@ -537,7 +537,30 @@
|
||||
"bilibiliResolving": "📺 Resolving Bilibili video...",
|
||||
"bilibiliNoAudio": "❌ No playable audio for **{{title}}** — the video may be region-locked, premium-only, or deleted.",
|
||||
"bilibiliError": "❌ Bilibili: {{message}}",
|
||||
"bilibiliDisabled": "❌ Bilibili playback is disabled (config.json → bilibili.enabled)."
|
||||
"bilibiliDisabled": "❌ Bilibili playback is disabled (config.json → bilibili.enabled).",
|
||||
"sourceRadio": "24/7 Radio",
|
||||
"sourceMusic": "Music",
|
||||
"station": "Station",
|
||||
"channel": "Channel",
|
||||
"artist": "Artist",
|
||||
"modeVol": "Mode / Vol",
|
||||
"volume": "Volume",
|
||||
"liveBroadcast": "Live Broadcast",
|
||||
"customCut": "Custom Cut",
|
||||
"unknownAuthor": "Unknown Artist",
|
||||
"unknownTrack": "Unknown Track",
|
||||
"endOfQueue": "End of queue",
|
||||
"none": "None",
|
||||
"on": "On",
|
||||
"off": "Off",
|
||||
"nowPlayingFooter": "Queue: {{count}} {{plural}} ({{remaining}}) • Next: {{next}}",
|
||||
"nowPlayingFooterEmpty": "Queue: Empty • Autoplay: {{autoplay}}",
|
||||
"loopSongLabel": "Song",
|
||||
"loopQueueLabel": "Queue",
|
||||
"loopOffLabel": "Off",
|
||||
"sourceSpotify": "Spotify",
|
||||
"sourceSoundcloud": "SoundCloud",
|
||||
"sourceYoutube": "YouTube"
|
||||
},
|
||||
"playnext": {
|
||||
"searching": "🔍 Searching..."
|
||||
|
||||
@@ -420,7 +420,30 @@
|
||||
"bilibiliResolving": "📺 Resolvendo vídeo do Bilibili...",
|
||||
"bilibiliNoAudio": "❌ Nenhum áudio reproduzível para **{{title}}** — o vídeo pode estar bloqueado por região, ser pago ou ter sido excluído.",
|
||||
"bilibiliError": "❌ Bilibili: {{message}}",
|
||||
"bilibiliDisabled": "❌ A reprodução do Bilibili está desativada (config.json → bilibili.enabled)."
|
||||
"bilibiliDisabled": "❌ A reprodução do Bilibili está desativada (config.json → bilibili.enabled).",
|
||||
"sourceRadio": "Rádio 24/7",
|
||||
"sourceMusic": "Música",
|
||||
"station": "Estação",
|
||||
"channel": "Canal",
|
||||
"artist": "Artista",
|
||||
"modeVol": "Modo / Vol",
|
||||
"volume": "Volume",
|
||||
"liveBroadcast": "Transmissão ao Vivo",
|
||||
"customCut": "Corte Personalizado",
|
||||
"unknownAuthor": "Artista Desconhecido",
|
||||
"unknownTrack": "Faixa Desconhecida",
|
||||
"endOfQueue": "Fim da fila",
|
||||
"none": "Nenhum",
|
||||
"on": "Ligado",
|
||||
"off": "Desligado",
|
||||
"nowPlayingFooter": "Fila: {{count}} {{plural}} ({{remaining}}) • Próxima: {{next}}",
|
||||
"nowPlayingFooterEmpty": "Fila: Vazia • Autoplay: {{autoplay}}",
|
||||
"loopSongLabel": "Música",
|
||||
"loopQueueLabel": "Fila",
|
||||
"loopOffLabel": "Desligado",
|
||||
"sourceSpotify": "Spotify",
|
||||
"sourceSoundcloud": "SoundCloud",
|
||||
"sourceYoutube": "YouTube"
|
||||
},
|
||||
"playnext": {
|
||||
"searching": "🔍 Buscando..."
|
||||
|
||||
@@ -526,7 +526,30 @@
|
||||
"bilibiliResolving": "📺 Bilibili videosu çözümleniyor...",
|
||||
"bilibiliNoAudio": "❌ **{{title}}** için çalınabilir ses yok — video bölge kilitli, ücretli olabilir veya silinmiş olabilir.",
|
||||
"bilibiliError": "❌ Bilibili: {{message}}",
|
||||
"bilibiliDisabled": "❌ Bilibili oynatma devre dışı (config.json → bilibili.enabled)."
|
||||
"bilibiliDisabled": "❌ Bilibili oynatma devre dışı (config.json → bilibili.enabled).",
|
||||
"sourceRadio": "7/24 Radyo",
|
||||
"sourceMusic": "Müzik",
|
||||
"station": "İstasyon",
|
||||
"channel": "Kanal",
|
||||
"artist": "Sanatçı",
|
||||
"modeVol": "Mod / Ses",
|
||||
"volume": "Ses",
|
||||
"liveBroadcast": "Canlı Yayın",
|
||||
"customCut": "Özel Kesim",
|
||||
"unknownAuthor": "Bilinmeyen Sanatçı",
|
||||
"unknownTrack": "Bilinmeyen Şarkı",
|
||||
"endOfQueue": "Kuyruk sonu",
|
||||
"none": "Yok",
|
||||
"on": "Açık",
|
||||
"off": "Kapalı",
|
||||
"nowPlayingFooter": "Kuyruk: {{count}} {{plural}} ({{remaining}}) • Sıradaki: {{next}}",
|
||||
"nowPlayingFooterEmpty": "Kuyruk: Boş • Otomatik Oynatma: {{autoplay}}",
|
||||
"loopSongLabel": "Şarkı",
|
||||
"loopQueueLabel": "Kuyruk",
|
||||
"loopOffLabel": "Kapalı",
|
||||
"sourceSpotify": "Spotify",
|
||||
"sourceSoundcloud": "SoundCloud",
|
||||
"sourceYoutube": "YouTube"
|
||||
},
|
||||
"playnext": {
|
||||
"searching": "🔍 Aranıyor..."
|
||||
|
||||
Reference in new issue
Block a user