diff --git a/commands/list.mjs b/commands/list.mjs index 94a2ee3..20cc31a 100644 --- a/commands/list.mjs +++ b/commands/list.mjs @@ -65,7 +65,7 @@ export async function run(message, data) { const elapsed = p.getCurrentElapsedDuration(); const total = p.getCurrentDuration(); const link = current.spotifyUrl || current.url || ""; - let title = current.title; + let title = current.title ?? "Unknown"; if (title.length > 50) title = title.slice(0, 47) + "..."; const titleFmt = link ? `[${title}](${link})` : title; @@ -84,7 +84,7 @@ export async function run(message, data) { const index = String(start + i + 1).padStart(2, " "); const dur = vid.duration ? p.getDuration(vid.duration) : "?:??"; const link = vid.spotifyUrl || vid.url || ""; - let title = vid.title; + let title = vid.title ?? "Unknown"; if (title.length > 45) title = title.slice(0, 42) + "..."; title = link ? `[${title}](${link})` : title; const upNext = (start + i === 0) ? " ▶" : ""; diff --git a/commands/player.mjs b/commands/player.mjs index 9e1e74e..bc10dcd 100644 --- a/commands/player.mjs +++ b/commands/player.mjs @@ -243,10 +243,22 @@ export async function run(msg) { reply = player.pause(); break; - case "stop": + case "stop": { + const hadCurrent = !!player.queue.getCurrent(); + player._lastPlayedTrack = player.queue.getCurrent() ?? player._lastPlayedTrack; player.queue.reset(); + player._activeTrackOpt = null; + player._clearTrackEndTimer?.(); + player._bridgeStop?.(); + player._paused = false; + player._pausedAt = null; + if (hadCurrent) { + player.emit("stopplay"); + if (!player._is247Enabled?.()) player._startInactivityTimer?.(); + } reply = this.t(msg, "responses.player.stoppedCleared"); break; + } case "skip": reply = player.skip(); diff --git a/commands/radio.mjs b/commands/radio.mjs index c032a9b..56dfe37 100644 --- a/commands/radio.mjs +++ b/commands/radio.mjs @@ -53,8 +53,10 @@ export async function run(msg, data) { let desc = `📻 **Radio Stations (Page ${page + 1}/${totalPages})**\n\n`; pickable.forEach((r, i) => { - desc += `${NUMBER_EMOJIS[i]} **${r.detailedName}** (\`${r.name}\`)\n`; - desc += ` ${r.description.replaceAll("\n", "\n ")}\n\n`; + const displayName = r.detailedName ?? r.name ?? "Station"; + const stationDesc = String(r.description ?? "").replaceAll("\n", "\n "); + desc += `${NUMBER_EMOJIS[i]} **${displayName}** (\`${r.name ?? "station"}\`)\n`; + desc += ` ${stationDesc}\n\n`; }); desc += `⬅️ Previous ➡️ Next ❌ Cancel`; @@ -126,9 +128,9 @@ export async function run(msg, data) { } if (input) { - const radio = radios.find(r => r.name.toLowerCase() === input); + const radio = radios.find(r => String(r.name ?? "").toLowerCase() === input); if (!radio) { - const names = radios.map(r => `\`${r.name}\``).join(", "); + const names = radios.map(r => `\`${r.name ?? "station"}\``).join(", "); return msg.reply(this.t(msg, "responses.radio.unknownStation", { station: input, stations: names })); } return playStation(this, msg, radio); @@ -157,12 +159,18 @@ async function playStation(ctx, msg, radio, editTarget = null) { else p.playRadio(radio); const prefix = ctx.handler.getPrefix(msg?.channel?.channel?.guildId ?? msg?.message?.guildId); + const stationName = radio.detailedName ?? radio.name ?? "Radio Station"; + const stationUrl = radio.author?.url ?? ""; + const stationDesc = String(radio.description ?? ""); + const stationLine = stationUrl + ? `**[${stationName}](${stationUrl})**\n\n` + : `**${stationName}**\n\n`; const embed = new EmbedBuilder() .setColor(getGlobalColor()) - .setTitle(`📻 ${radio.detailedName}`) + .setTitle(`📻 ${stationName}`) .setDescription( - `**[${radio.detailedName}](${radio.author.url})**\n\n` + - `${radio.description}\n\n` + + stationLine + + `${stationDesc}\n\n` + `_Use \`${prefix}skip\` to stop the radio, or \`${prefix}radio list\` to switch stations._` ) ; diff --git a/src/music/PlayerLifecycleMixin.mjs b/src/music/PlayerLifecycleMixin.mjs index 5e6070c..98ab7cb 100644 --- a/src/music/PlayerLifecycleMixin.mjs +++ b/src/music/PlayerLifecycleMixin.mjs @@ -590,12 +590,12 @@ const PlayerLifecycleMixin = { return player; } catch (retryErr) { logger.warn(`[PlayerManager] Retry also failed for channel ${cleanChannelId}: ${retryErr.message}`); - errorMsg = this._t(message, "responses.join.joinFailedGeneric"); + errorMsg = this._t(message, "responses._common.joinFailedGeneric"); } } else if (errCode === "PERMISSION") { errorMsg = this._t(message, "responses.join.joinFailedPerms", { channel: cleanChannelId }); } else if (errCode === "NOT_FOUND") { - errorMsg = this._t(message, "responses.join.joinFailedNotFound"); + errorMsg = this._t(message, "responses._common.joinFailedNotFound"); } else if (errCode === "TIMEOUT") { errorMsg = this._t(message, "responses.join.joinFailed"); } else { diff --git a/storage/locales/bot/ar-SA.json b/storage/locales/bot/ar-SA.json index 52cbff9..5c8787d 100644 --- a/storage/locales/bot/ar-SA.json +++ b/storage/locales/bot/ar-SA.json @@ -199,6 +199,7 @@ "responses": { "_common": { "nothingPlaying": "❌ لا يوجد شيء يعمل حالياً!", + "serverOnlyForMusic": "🎵 الموسيقى تحتاج إلى **قناة صوتية داخل سيرفر** — لا أستطيع الانضمام إلى الصوت في الرسائل الخاصة. استخدم الأمر داخل سيرفر بدلاً من ذلك!", "noVoiceChannel": "⚠️ يرجى الانضمام إلى قناة صوتية أولاً.", "noVoiceStrict": "⚠️ يجب عليك الانضمام إلى قناة صوتية لاستخدام هذا الأمر.", "alreadyInChannel": "⚠️ أنا أعزف بالفعل في {{channels}}. انضم إلى تلك القناة أو استخدم `{{prefix}}play` لبدء الموسيقى في قناتك.", diff --git a/storage/locales/bot/ckb.json b/storage/locales/bot/ckb.json index 2c190cf..a6c88b3 100644 --- a/storage/locales/bot/ckb.json +++ b/storage/locales/bot/ckb.json @@ -199,6 +199,7 @@ "responses": { "_common": { "nothingPlaying": "❌ هیچ شتێک پەخش ناکرێت لە ئێستادا!", + "serverOnlyForMusic": "🎵 مۆسیقا پێویستی بە **کەناڵێکی دەنگی لە سێرڤەردا** هەیە — ناتوانم لە پەیامە تایبەتەکاندا بێتە دەنگەوە. فەرمانەکە لە سێرڤەردا بەکاربهێنە!", "noVoiceChannel": "⚠️ تکایە سەرەتا بەشداری کەناڵێکی دەنگی بکە.", "noVoiceStrict": "⚠️ پێویستە سەرەتا بەشداری کەناڵێکی دەنگی بکەیت بۆ بەکارهێنانی ئەم فەرمانە.", "alreadyInChannel": "⚠️ من پێشتر لە {{channels}} پەخش دەکەم. بەشداری ئەو کەناڵە بکە یان `{{prefix}}play` بەکاربهێنە بۆ دەستپێکردنی موزیک لە کەناڵەکەت.", diff --git a/storage/locales/bot/de-DE.json b/storage/locales/bot/de-DE.json index 9cc67dd..faf7b11 100644 --- a/storage/locales/bot/de-DE.json +++ b/storage/locales/bot/de-DE.json @@ -199,6 +199,7 @@ "responses": { "_common": { "nothingPlaying": "❌ Es wird gerade nichts abgespielt!", + "serverOnlyForMusic": "🎵 Musik braucht einen **Sprachkanal in einem Server** — ich kann mich nicht mit Sprachchat in DMs verbinden. Führe den Befehl stattdessen in einem Server aus!", "noVoiceChannel": "⚠️ Bitte trete zuerst einem Sprachkanal bei.", "noVoiceStrict": "⚠️ Du musst einem Sprachkanal beitreten, um diesen Befehl zu nutzen.", "alreadyInChannel": "⚠️ Ich spiele bereits in {{channels}}. Trete diesem Kanal bei oder nutze `{{prefix}}play`, um Musik in deinem Kanal zu starten.", diff --git a/storage/locales/bot/pt-BR.json b/storage/locales/bot/pt-BR.json index d875d7b..47a887a 100644 --- a/storage/locales/bot/pt-BR.json +++ b/storage/locales/bot/pt-BR.json @@ -199,6 +199,7 @@ "responses": { "_common": { "nothingPlaying": "❌ Não está tocando nada no momento!", + "serverOnlyForMusic": "🎵 Música precisa de um **canal de voz em um servidor** — não consigo entrar em voz nas DMs. Use o comando em um servidor!", "noVoiceChannel": "⚠️ Por favor, entre em um canal de voz primeiro.", "noVoiceStrict": "⚠️ Você precisa entrar em um canal de voz para usar este comando.", "alreadyInChannel": "⚠️ Já estou tocando em {{channels}}. Entre nesse canal ou use `{{prefix}}play` para começar a tocar no seu canal.", diff --git a/storage/locales/bot/tr.json b/storage/locales/bot/tr.json index 0ff36bd..ba539f0 100644 --- a/storage/locales/bot/tr.json +++ b/storage/locales/bot/tr.json @@ -199,6 +199,7 @@ "responses": { "_common": { "nothingPlaying": "❌ Şu anda çalan bir şey yok!", + "serverOnlyForMusic": "🎵 Müzik için bir **sunucudaki ses kanalı** gerekiyor — DM'lerde sesli kanala katılamam. Komutu bunun yerine bir sunucuda kullan!", "noVoiceChannel": "⚠️ Lütfen önce bir ses kanalına katılın.", "noVoiceStrict": "⚠️ Bu komutu kullanmak için bir ses kanalına katılmanız gerekiyor.", "alreadyInChannel": "⚠️ Zaten {{channels}} kanalında çalıyorum. O kanala katılın veya kendi kanalınızda müzik başlatmak için `{{prefix}}play` kullanın.",