From 58b22826df379f32611e39f7e6e96d21194b14bb Mon Sep 17 00:00:00 2001 From: derpystuff <3515180-derpystuff@users.noreply.gitlab.com> Date: Sun, 25 Jun 2023 12:46:37 +0200 Subject: [PATCH] add no result warnings --- commands/message/core/ping.js | 1 - commands/message/search/bing-images.js | 2 ++ commands/message/search/bing.js | 2 ++ commands/message/search/google-images.js | 2 ++ commands/message/search/google.js | 2 ++ 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/commands/message/core/ping.js b/commands/message/core/ping.js index f758bb2..3a4d466 100644 --- a/commands/message/core/ping.js +++ b/commands/message/core/ping.js @@ -20,7 +20,6 @@ module.exports = { context.triggerTyping(); ping = await context.client.ping() editOrReply(context, { - content: "", embeds: [createEmbed("default", context, { description: `${icon("connection")} **Pong!**\n` + codeblock("ansi", [`rest ${format(`${ping.rest}ms`, "m")}`, `gateway ${format(`${ping.gateway}ms`, "m")}`]) })] diff --git a/commands/message/search/bing-images.js b/commands/message/search/bing-images.js index 15146a4..a3d665b 100644 --- a/commands/message/search/bing-images.js +++ b/commands/message/search/bing-images.js @@ -56,6 +56,8 @@ module.exports = { pages.push(createImageResultPage(context, res)) } + if(!pages.length) return editOrReply(context, {embeds:[createEmbed("warning", context, `No results found.`)]}) + pages = formatPaginationEmbeds(pages) const paging = await paginator.createPaginator({ context, diff --git a/commands/message/search/bing.js b/commands/message/search/bing.js index f10e475..5065d90 100644 --- a/commands/message/search/bing.js +++ b/commands/message/search/bing.js @@ -121,6 +121,8 @@ module.exports = { if(sp) pages.push(sp) } + if(!pages.length) return editOrReply(context, {embeds:[createEmbed("warning", context, `No results found.`)]}) + pages = formatPaginationEmbeds(pages) const paging = await paginator.createPaginator({ context, diff --git a/commands/message/search/google-images.js b/commands/message/search/google-images.js index f7738f6..38330ba 100644 --- a/commands/message/search/google-images.js +++ b/commands/message/search/google-images.js @@ -56,6 +56,8 @@ module.exports = { pages.push(createImageResultPage(context, res)) } + if(!pages.length) return editOrReply(context, {embeds:[createEmbed("warning", context, `No results found.`)]}) + pages = formatPaginationEmbeds(pages) const paging = await paginator.createPaginator({ context, diff --git a/commands/message/search/google.js b/commands/message/search/google.js index cbc50ba..b7e6d59 100644 --- a/commands/message/search/google.js +++ b/commands/message/search/google.js @@ -78,6 +78,8 @@ module.exports = { for(const res of search.body.results){ pages.push(createSearchResultPage(context, res)) } + + if(!pages.length) return editOrReply(context, {embeds:[createEmbed("warning", context, `No results found.`)]}) pages = formatPaginationEmbeds(pages) const paging = await paginator.createPaginator({