diff --git a/commands/play.js b/commands/play.js index ac34a1f27..1adfad4b8 100644 --- a/commands/play.js +++ b/commands/play.js @@ -104,6 +104,12 @@ module.exports = { } else { try { const results = await youtube.searchVideos(search, 1, { part: "snippet" }); + // PATCH 1 : avoid cases when there are nothing on the search results. + if (results.length <= 0) { + // No video results. + message.reply(i18n.__mf("play.songNotFound")).catch(console.error); + return; + } songInfo = await ytdl.getInfo(results[0].url); song = { title: songInfo.videoDetails.title, diff --git a/config.json.example b/config.json.example index ca54df047..72d9c1e1f 100644 --- a/config.json.example +++ b/config.json.example @@ -8,4 +8,4 @@ "LOCALE": "en", "STAY_TIME": 30, "DEFAULT_VOLUME": 100 -} +} \ No newline at end of file diff --git a/locales/ar.json b/locales/ar.json index 2369ae377..b2153cebd 100644 --- a/locales/ar.json +++ b/locales/ar.json @@ -70,7 +70,8 @@ "increasedVolume": "<@{author}> 🔊 **{volume}%** زاد الصوت, مستوي الصوت الان هو", "loopSong": "<@{author}> التكرار الان {loop}", "stopSong": "<@{author}> أوقف الموسيقى ⏹", - "leaveChannel": "جارٍ ترك القناة الصوتية..." + "leaveChannel": "جارٍ ترك القناة الصوتية...", + "songNotFound": "Audio Not Found" }, "playlist": { "description": "تشغيل قائمة تشغيل من يوتيوب", diff --git a/locales/de.json b/locales/de.json index 04ac9faf9..a3a5d64fb 100644 --- a/locales/de.json +++ b/locales/de.json @@ -70,7 +70,8 @@ "increasedVolume": "<@{author}> 🔊 hat die Lautstärke erhöht, sie ist jetzt auf {volume}%", "loopSong": "<@{author}> Musikschleife ist nun auf {loop}", "stopSong": "<@{author}> ⏹ hat die Musik gestoppt!", - "leaveChannel": "Verlasse den Voice-Channel..." + "leaveChannel": "Verlasse den Voice-Channel...", + "songNotFound": "Audio Not Found" }, "playlist": { "description": "Spielt eine Playlist von Youtube ab", diff --git a/locales/en.json b/locales/en.json index 4c048cd08..d97dfbedf 100644 --- a/locales/en.json +++ b/locales/en.json @@ -70,7 +70,8 @@ "increasedVolume": "<@{author}> 🔊 increased the volume, the volume is now {volume}%", "loopSong": "<@{author}> Loop is now {loop}", "stopSong": "<@{author}> ⏹ stopped the music!", - "leaveChannel": "Leaving voice channel..." + "leaveChannel": "Leaving voice channel...", + "songNotFound": "Audio Not Found" }, "playlist": { "description": "Play a playlist from youtube", diff --git a/locales/es.json b/locales/es.json index a54cac80e..d5021e55f 100644 --- a/locales/es.json +++ b/locales/es.json @@ -70,7 +70,8 @@ "increasedVolume": "<@{author}> 🔊 Subió el volumen de la música, el volumen actual ahora es {volume}%", "loopSong": "<@{author}> El bucle actual es {loop}", "stopSong": "<@{author}> ⏹ ¡Paró la música!", - "leaveChannel": "Saliendo del chat de voz..." + "leaveChannel": "Saliendo del chat de voz...", + "songNotFound": "Audio Not Found" }, "playlist": { "description": "Reproduce una lista de reproducción de youtube", diff --git a/locales/fr.json b/locales/fr.json index f36bd23b8..5761872ec 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -64,7 +64,8 @@ "increasedVolume": "<@{author}> 🔊 augmente le volume, le volume est maintenant {volume}%", "loopSong": "<@{author}> Loop est maintenant {loop}", "stopSong": "<@{author}> ⏹ arrête la musique!", - "leaveChannel": "Quitte le salon vocal..." + "leaveChannel": "Quitte le salon vocal...", + "songNotFound": "Audio Not Found" }, "playlist": { "description": "Écoute une playlist venant de YouTube", diff --git a/locales/it.json b/locales/it.json index 78d4c31e8..a604330a6 100644 --- a/locales/it.json +++ b/locales/it.json @@ -70,7 +70,8 @@ "increasedVolume": "<@{author}> 🔊 aumentato il volume, il volume è ora {volume}%", "loopSong": "<@{author}> Ora in riproduzione {loop}", "stopSong": "<@{author}> ⏹ fermato la musica!", - "leaveChannel": "Uscita dal canale vocale ..." + "leaveChannel": "Uscita dal canale vocale ...", + "songNotFound": "Audio Not Found" }, "playlist": { "description": "Riproduci una playlist da youtube", diff --git a/locales/ko.json b/locales/ko.json index 79cd88c02..ea164ceb4 100644 --- a/locales/ko.json +++ b/locales/ko.json @@ -70,7 +70,8 @@ "increasedVolume": "<@{author}> 🔊 볼륨을 높어, 현재 {volume}% 로 설정되어 있습니다", "loopSong": "<@{author}> 음악 반복 상태: {loop}", "stopSong": "<@{author}> ⏹ 음악을 중지했습니다.", - "leaveChannel": "채널을 떠나는 중입니다." + "leaveChannel": "채널을 떠나는 중입니다.", + "songNotFound": "Audio Not Found" }, "playlist": { "description": "Youtube 부터 재생목록을 재생합니다.", diff --git a/locales/nl.json b/locales/nl.json index b56c8f72b..529469509 100644 --- a/locales/nl.json +++ b/locales/nl.json @@ -70,7 +70,8 @@ "increasedVolume": "<@{author}> 🔊 verhoogde het volume, het volume is nu {volume}%", "loopSong": "<@{author}> Herhaling is nu {loop}", "stopSong": "<@{author}> ⏹ stopte de muziek!", - "leaveChannel": "Voice channel verlaten..." + "leaveChannel": "Voice channel verlaten...", + "songNotFound": "Audio Not Found" }, "playlist": { "description": "Speel een playlist af van youtube", diff --git a/locales/pl.json b/locales/pl.json index 74b82a8bd..3db53bb74 100644 --- a/locales/pl.json +++ b/locales/pl.json @@ -70,7 +70,8 @@ "increasedVolume": "<@{author}> 🔊 podniósł poziom głośności, wynosi teraz: {volume}%", "loopSong": "<@{author}> Przełączył pętlę na: {loop}", "stopSong": "<@{author}> ⏹ Zatrzymał odtwarzanie!", - "leaveChannel": "Opuszczanie kanału głosowego..." + "leaveChannel": "Opuszczanie kanału głosowego...", + "songNotFound": "Audio Not Found" }, "playlist": { "description": "Odtwarza listę odtwarzania z youtuba", diff --git a/locales/pt_br.json b/locales/pt_br.json index 59ca58ed3..827ea1cf1 100644 --- a/locales/pt_br.json +++ b/locales/pt_br.json @@ -70,7 +70,8 @@ "increasedVolume": "<@{author}> 🔊 aumentou o volume, o volume agora é {volume}%", "loopSong": "<@{author}> Repetir está {loop}", "stopSong": "<@{author}> ⏹ parou a música!", - "leaveChannel": "Deixando o canal de voz!" + "leaveChannel": "Deixando o canal de voz!", + "songNotFound": "Audio Not Found" }, "playlist": { "description": "Reproduz uma playlist do youtube", diff --git a/locales/ru.json b/locales/ru.json index 25623b11e..f8f19275e 100644 --- a/locales/ru.json +++ b/locales/ru.json @@ -70,7 +70,8 @@ "increasedVolume": "<@{author}> 🔊 увеличил громкость, теперь громкость {volume}%", "loopSong": "<@{author}> Сейчас Повторяется {loop}", "stopSong": "<@{author}> ⏹ остановил музыку!", - "leaveChannel": "Выход из голосового канала..." + "leaveChannel": "Выход из голосового канала...", + "songNotFound": "Audio Not Found" }, "playlist": { "description": "Воспроизвести плейлист с YouTube", diff --git a/locales/sv.json b/locales/sv.json index 1e030a3c2..737f19f01 100644 --- a/locales/sv.json +++ b/locales/sv.json @@ -70,7 +70,8 @@ "increasedVolume": "<@{author}> 🔊 ökade volymen, volymen är nu {volume}%", "loopSong": "<@{author}> Loop är nu {loop}", "stopSong": "<@{author}> ⏹ stoppade musiken!", - "leaveChannel": "Lämna röstkanal..." + "leaveChannel": "Lämna röstkanal...", + "songNotFound": "Audio Not Found" }, "playlist": { "description": "Spela en spellista från youtube", diff --git a/locales/tr.json b/locales/tr.json index 8aede4a4d..36b237356 100644 --- a/locales/tr.json +++ b/locales/tr.json @@ -70,7 +70,8 @@ "increasedVolume": "<@{author}> 🔊 sesi artırdı ses seviyesi {volume}%", "loopSong": "<@{author}> Döngü şuan {loop}", "stopSong": "<@{author}> ⏹ müziği durdurdu!", - "leaveChannel": "Sesli kanaldan çıkıyor..." + "leaveChannel": "Sesli kanaldan çıkıyor...", + "songNotFound": "Audio Not Found" }, "playlist": { "description": "Youtubeden bir çalma listesi oynat", diff --git a/locales/zh_cn.json b/locales/zh_cn.json index 4fb5a8e52..553e681aa 100644 --- a/locales/zh_cn.json +++ b/locales/zh_cn.json @@ -70,7 +70,8 @@ "increasedVolume": "<@{author}> 🔊 增加了音量, 目前音量为 {volume}%", "loopSong": "<@{author}> 重複播放目前是 {loop}", "stopSong": "<@{author}> ⏹ 停止了歌曲!", - "leaveChannel": "正在离开语音频道..." + "leaveChannel": "正在离开语音频道...", + "songNotFound": "Audio Not Found" }, "playlist": { "description": "播放 YouTube 的播放清单", diff --git a/locales/zh_tw.json b/locales/zh_tw.json index 23c1bef2a..cc70dfc8b 100644 --- a/locales/zh_tw.json +++ b/locales/zh_tw.json @@ -70,7 +70,8 @@ "increasedVolume": "<@{author}> 🔊 增加了音量, 目前音量為 {volume}%", "loopSong": "<@{author}> 重複播放目前是 {loop}", "stopSong": "<@{author}> ⏹ 停止了歌曲!", - "leaveChannel": "正在離開語音頻道..." + "leaveChannel": "正在離開語音頻道...", + "songNotFound": "Audio Not Found" }, "playlist": { "description": "播放 YouTube 的播放清單", diff --git a/package-lock.json b/package-lock.json index e4459b8b3..dca9e4388 100644 --- a/package-lock.json +++ b/package-lock.json @@ -966,4 +966,4 @@ } } } -} +} \ No newline at end of file