From 52d2bbbc2db3d9ff74756a963e59ed6aa540daba Mon Sep 17 00:00:00 2001 From: derpystuff <3515180-derpystuff@users.noreply.gitlab.com> Date: Wed, 13 Jul 2022 14:03:08 +0200 Subject: [PATCH] adds no search result errors --- commands/message/search/audio.js | 4 ++-- commands/message/search/bing-images.js | 2 ++ commands/message/search/bing.js | 2 ++ commands/message/search/google-images.js | 2 ++ labscore/api/endpoints.js | 2 +- labscore/api/index.js | 2 +- 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/commands/message/search/audio.js b/commands/message/search/audio.js index 9ef84e8..b435cb4 100644 --- a/commands/message/search/audio.js +++ b/commands/message/search/audio.js @@ -13,10 +13,10 @@ module.exports = { name: 'audio', aliases: ['aud'], metadata: { - description: 'video audio detection', + description: '**audio detection**\nusing the audio command without replying to a message will try to identify the song in the most recent video\n\n**music platform links**\n__replying__ to a message while using this command will return a list of music platforms the provided music (link) is available on', examples: ['aud'], category: 'search', - usage: 'audio ' + usage: 'audio' }, run: async (context) => { context.triggerTyping(); diff --git a/commands/message/search/bing-images.js b/commands/message/search/bing-images.js index 66f0cfc..a27c682 100644 --- a/commands/message/search/bing-images.js +++ b/commands/message/search/bing-images.js @@ -41,6 +41,8 @@ module.exports = { try{ let search = await bingImages(context, args.query, context.channel.nsfw) search = search.response + + if(search.body.status == 2) return editOrReply(context, {embeds:[createEmbed("error", context, search.body.message)]}) let pages = [] for(const res of search.body.results){ diff --git a/commands/message/search/bing.js b/commands/message/search/bing.js index 7a99df7..066e9b7 100644 --- a/commands/message/search/bing.js +++ b/commands/message/search/bing.js @@ -38,6 +38,8 @@ module.exports = { let search = await bing(context, args.query, context.channel.nsfw) search = search.response + if(search.body.status == 2) return editOrReply(context, {embeds:[createEmbed("error", context, search.body.message)]}) + let pages = [] for(const res of search.body.results){ pages.push(createSearchResultPage(context, res)) diff --git a/commands/message/search/google-images.js b/commands/message/search/google-images.js index 8422d95..10420fd 100644 --- a/commands/message/search/google-images.js +++ b/commands/message/search/google-images.js @@ -42,6 +42,8 @@ module.exports = { let search = await googleImages(context, args.query, context.channel.nsfw) search = search.response + if(search.body.status == 2) return editOrReply(context, {embeds:[createEmbed("error", context, search.body.message)]}) + let pages = [] for(const res of search.body.results){ pages.push(createImageResultPage(context, res)) diff --git a/labscore/api/endpoints.js b/labscore/api/endpoints.js index 4e4f5c5..9b4517c 100644 --- a/labscore/api/endpoints.js +++ b/labscore/api/endpoints.js @@ -1,6 +1,6 @@ const Hosts = Object.freeze({ prod: "https://labscore-v2.vercel.app", - local: "http://localhost:3000", + local: "http://localhost", emoji: "https://derpystuff.gitlab.io/webstorage3/container/", statics: "https://derpystuff.gitlab.io/webstorage4/v2/" }) diff --git a/labscore/api/index.js b/labscore/api/index.js index dc31778..082b192 100644 --- a/labscore/api/index.js +++ b/labscore/api/index.js @@ -5,7 +5,7 @@ const { Api, Static, Hosts } = require('./endpoints') async function request(path, type, headers, args, host) { let timing = Date.now(); url = Api.HOST + path - if(process.env.USE_LOCAL_API) url = Hosts.local + path + if(process.env.USE_LOCAL_API) url = Hosts.local + ":" + process.env.USE_LOCAL_API + path if(host) url = host + path // apply default headers