diff --git a/commands/interaction/slash/search/google.js b/commands/interaction/slash/search/google.js index 1ac6a6e..325819a 100644 --- a/commands/interaction/slash/search/google.js +++ b/commands/interaction/slash/search/google.js @@ -3,9 +3,9 @@ const { paginator } = require('#client'); const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed'); const { acknowledge } = require('#utils/interactions'); -const { link, citation, icon } = require('#utils/markdown') +const { link, citation, icon, smallPill, pill, codeblock } = require('#utils/markdown') const { editOrReply } = require('#utils/message') -const { STATICS } = require('#utils/statics') +const { STATICS, STATIC_ICONS } = require('#utils/statics') const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants'); @@ -27,7 +27,10 @@ const SEARCH_CARD_TYPES = { SEARCH_RESULT: 1, KNOWLEDGE_GRAPH: 2, DOODLE: 3, - ENTITY: 4 + ENTITY: 4, + CALCULATOR: 5, + UNIT_CONVERTER: 6, + DICTIONARY: 7 } // TODO: create a favicon() util @@ -105,6 +108,22 @@ function createSearchResultPage(context, result, doodle){ if(result.card.link) res.author.url = result.card.link + break; + case SEARCH_CARD_TYPES.CALCULATOR: + res = createEmbed("default", context, { + author: { + name: result.query, + iconUrl: STATIC_ICONS.search_calculator + }, + description: codeblock("ansi",[result.result]), + footer: renderFooter(context, doodle) + }) + break; + case SEARCH_CARD_TYPES.UNIT_CONVERTER: + res = createEmbed("default", context, { + description: `### Unit Converter\n \n${smallPill(result.units[0])} ${icon("equals")} ${pill(result.units[1])}`, + 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 f484cdb..ccf6b09 100644 --- a/commands/message/search/google.js +++ b/commands/message/search/google.js @@ -2,9 +2,9 @@ const { google } = require('#api'); const { paginator } = require('#client'); const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed') -const { link, citation, icon, stringwrap } = require('#utils/markdown') +const { link, citation, icon, stringwrap, codeblock, pill, smallPill } = require('#utils/markdown') const { editOrReply } = require('#utils/message') -const { STATICS } = require('#utils/statics') +const { STATICS, STATIC_ICONS } = require('#utils/statics') // TODO: Turn this into a general purpose permissions constant const { Permissions } = require("detritus-client/lib/constants"); @@ -28,7 +28,10 @@ const SEARCH_CARD_TYPES = { SEARCH_RESULT: 1, KNOWLEDGE_GRAPH: 2, DOODLE: 3, - ENTITY: 4 + ENTITY: 4, + CALCULATOR: 5, + UNIT_CONVERTER: 6, + DICTIONARY: 7 } // TODO: create a favicon() util @@ -106,6 +109,22 @@ function createSearchResultPage(context, result, doodle){ if(result.card.link) res.author.url = result.card.link + break; + case SEARCH_CARD_TYPES.CALCULATOR: + res = createEmbed("default", context, { + author: { + name: result.query, + iconUrl: STATIC_ICONS.search_calculator + }, + description: codeblock("ansi",[result.result]), + footer: renderFooter(context, doodle) + }) + break; + case SEARCH_CARD_TYPES.UNIT_CONVERTER: + res = createEmbed("default", context, { + description: `### Unit Converter\n \n${smallPill(result.units[0])} ${icon("equals")} ${pill(result.units[1])}`, + footer: renderFooter(context, doodle) + }) break; default: res = createEmbed("error", context, "Unknown GoogleResult Type: " + result.type) diff --git a/labscore/constants.js b/labscore/constants.js index 04a5847..a44c579 100644 --- a/labscore/constants.js +++ b/labscore/constants.js @@ -82,6 +82,7 @@ module.exports.ICONS = Object.freeze({ "clock": "<:ico_clock:1263592462841020537>", "definition": "<:ico_definition:1263592450136473684>", "example": "<:ico_example:1263592408021471253>", + "equals": "<:ico_equals:1266486823992168468>", "flag": "<:ico_flag:1263592391630127114>", "list": "<:ico_list:1263592365994803306>", "mag": "<:ico_mag:1263592345845108747>", diff --git a/labscore/utils/statics.js b/labscore/utils/statics.js index 805fa00..dd34262 100644 --- a/labscore/utils/statics.js +++ b/labscore/utils/statics.js @@ -183,6 +183,10 @@ const Statics = Object.freeze({ warning: { file: "icons/core/ico_notice_warning.png", revision: 3 + }, + search_calculator: { + file: "search/calculator.78rasnkwtvo0.png", + revision: 1 } } }) @@ -234,7 +238,8 @@ module.exports.STATIC_ICONS = Object.freeze({ ai_summary: staticAsset(Statics.icons.ai_summary), ai_image: staticAsset(Statics.icons.ai_image), ai_image_processing: staticAsset(Statics.icons.ai_image_processing), - warning: staticAsset(Statics.icons.warning) + warning: staticAsset(Statics.icons.warning), + search_calculator: staticAsset(Statics.icons.search_calculator) }) module.exports.STATIC_ASSETS = Object.freeze({