From 70ceb0f8f828ea22f8575fc614bb9248f9e97fc6 Mon Sep 17 00:00:00 2001 From: bignutty <3515180-bignutty@users.noreply.gitlab.com> Date: Mon, 2 Sep 2024 00:14:58 +0200 Subject: [PATCH] implement images result card --- commands/interaction/slash/search/google.js | 16 +++++++++++++++- commands/message/search/google.js | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/commands/interaction/slash/search/google.js b/commands/interaction/slash/search/google.js index 67eae18..88be6b1 100644 --- a/commands/interaction/slash/search/google.js +++ b/commands/interaction/slash/search/google.js @@ -36,7 +36,8 @@ const SEARCH_CARD_TYPES = { DATA_GENERIC: 20, DATA_FINANCE: 21, DATA_DICTIONARY: 22, - DATA_TRANSLATE: 23 + DATA_TRANSLATE: 23, + PIVOT_IMAGES: 100 } // TODO: create a favicon() util @@ -185,6 +186,19 @@ function createSearchResultPage(context, result, doodle){ } }) + break; + case SEARCH_CARD_TYPES.PIVOT_IMAGES: + res = createEmbed("default", context, { + author: { + name: result.card.title, + iconUrl: result.card.icon + }, + image: { + url: result.card.image + }, + footer: renderFooter(context, doodle) + }) + break; default: res = createEmbed("error", context, "Unknown GoogleResult Type: " + result.type) diff --git a/commands/message/search/google.js b/commands/message/search/google.js index 71e4b66..3cd0a0d 100644 --- a/commands/message/search/google.js +++ b/commands/message/search/google.js @@ -38,7 +38,8 @@ const SEARCH_CARD_TYPES = { DATA_GENERIC: 20, DATA_FINANCE: 21, DATA_DICTIONARY: 22, - DATA_TRANSLATE: 23 + DATA_TRANSLATE: 23, + PIVOT_IMAGES: 100 } // TODO: create a favicon() util @@ -187,6 +188,19 @@ function createSearchResultPage(context, result, doodle){ } }) + break; + case SEARCH_CARD_TYPES.PIVOT_IMAGES: + res = createEmbed("default", context, { + author: { + name: result.card.title, + iconUrl: result.card.icon + }, + image: { + url: result.card.image + }, + footer: renderFooter(context, doodle) + }) + break; default: res = createEmbed("error", context, "Unknown GoogleResult Type: " + result.type)