diff --git a/commands/search.ts b/commands/search.ts index 1103978bf..d3ac52c62 100644 --- a/commands/search.ts +++ b/commands/search.ts @@ -33,11 +33,14 @@ export default { results = await youtube.search(search, { limit: 10, type: "video" }); } catch (error: any) { console.error(error); - interaction.editReply({ content: i18n.__("common.errorCommand") }).catch(console.error); + return; } - if (!results) return; + if (!results || !results[0]) { + interaction.editReply({ content: i18n.__("search.noResults") }) + return; + } const options = results!.map((video) => { return { diff --git a/locales/en.json b/locales/en.json index 7af2898ac..80e8d0779 100644 --- a/locales/en.json +++ b/locales/en.json @@ -125,7 +125,8 @@ "errorNotChannel": "You need to join a voice channel first!", "resultEmbedTitle": "**Reply with the song number you want to play**", "resultEmbedDesc": "Results for: {search}", - "optionQuery": "Search query" + "optionQuery": "Search query", + "noResults": "No results for query, please try something else" }, "shuffle": { "description": "Shuffle queue",