diff --git a/commands/interaction/slash/search/google.js b/commands/interaction/slash/search/google.js index e7c7c7b..d9591aa 100644 --- a/commands/interaction/slash/search/google.js +++ b/commands/interaction/slash/search/google.js @@ -1,11 +1,12 @@ const { google } = require('#api'); const { paginator } = require('#client'); +const { format } = require('#utils/ansi'); const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed'); const { acknowledge } = require('#utils/interactions'); const { link, citation, icon, smallPill, pill, codeblock } = require('#utils/markdown') const { editOrReply } = require('#utils/message') -const { STATICS, STATIC_ICONS } = require('#utils/statics') +const { STATICS } = require('#utils/statics') const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants'); @@ -136,22 +137,20 @@ function createSearchResultPage(context, result, doodle){ 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) + description: `-# ${result.query} =\n**${codeblock("ansi",[format(result.result, "white")])}**`, + footer: { + iconUrl: STATICS.googlecalculator, + text: `Calculator • ${context.application.name}` + } }) break; case SEARCH_CARD_TYPES.UNIT_CONVERTER: res = createEmbed("default", context, { - author: { - name: result.query, - iconUrl: STATIC_ICONS.search_calculator - }, - description: `### Unit Converter\n${smallPill(result.units[0])} ​ ​ ​​${icon("arrow_right")} ​ ​ ​ ​${pill(result.units[1])}`, - footer: renderFooter(context, doodle) + description: `-# ${result.units[0]} =\n**${codeblock("ansi",[format(result.units[1], "white")])}**`, + footer: { + iconUrl: STATICS.googlecalculator, + text: `Unit Converter • ${context.application.name}` + } }) break; case SEARCH_CARD_TYPES.MAPS: @@ -187,7 +186,7 @@ function createSearchResultPage(context, result, doodle){ break; case SEARCH_CARD_TYPES.DATA_GENERIC: res = createEmbed("default", context, { - description: `-# ${result.fact.category} › **${result.fact.type}**\n# ${result.fact.result}`, + description: `-# ${result.fact.category} ${(result.fact.type ? `› **${result.fact.type}**` : '')}\n# ${result.fact.result}`, footer: renderFooter(context, doodle) }) @@ -202,7 +201,7 @@ function createSearchResultPage(context, result, doodle){ text: `Google Finance • ${context.application.name}` } }) - + break; case SEARCH_CARD_TYPES.DATA_DICTIONARY: res = createEmbed("default", context, { diff --git a/commands/message/search/google.js b/commands/message/search/google.js index 4f83717..1593077 100644 --- a/commands/message/search/google.js +++ b/commands/message/search/google.js @@ -1,10 +1,11 @@ const { google } = require('#api'); const { paginator } = require('#client'); +const { format } = require('#utils/ansi'); const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed') -const { link, citation, icon, stringwrap, codeblock, pill, smallPill } = require('#utils/markdown') +const { link, citation, icon, codeblock, pill, smallPill } = require('#utils/markdown') const { editOrReply } = require('#utils/message') -const { STATICS, STATIC_ICONS } = require('#utils/statics') +const { STATICS } = require('#utils/statics') // TODO: Turn this into a general purpose permissions constant const { Permissions } = require("detritus-client/lib/constants"); @@ -137,22 +138,20 @@ function createSearchResultPage(context, result, doodle){ 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) + description: `-# ${result.query} =\n**${codeblock("ansi",[format(result.result, "white")])}**`, + footer: { + iconUrl: STATICS.googlecalculator, + text: `Calculator • ${context.application.name}` + } }) break; case SEARCH_CARD_TYPES.UNIT_CONVERTER: res = createEmbed("default", context, { - author: { - name: result.query, - iconUrl: STATIC_ICONS.search_calculator - }, - description: `### Unit Converter\n${smallPill(result.units[0])} ​ ​ ​​${icon("arrow_right")} ​ ​ ​ ​${pill(result.units[1])}`, - footer: renderFooter(context, doodle) + description: `-# ${result.units[0]} =\n**${codeblock("ansi",[format(result.units[1], "white")])}**`, + footer: { + iconUrl: STATICS.googlecalculator, + text: `Unit Converter • ${context.application.name}` + } }) break; case SEARCH_CARD_TYPES.MAPS: @@ -188,7 +187,7 @@ function createSearchResultPage(context, result, doodle){ break; case SEARCH_CARD_TYPES.DATA_GENERIC: res = createEmbed("default", context, { - description: `-# ${result.fact.category} › **${result.fact.type}**\n# ${result.fact.result}`, + description: `-# ${result.fact.category} ${(result.fact.type ? `› **${result.fact.type}**` : '')}\n# ${result.fact.result}`, footer: renderFooter(context, doodle) }) diff --git a/labscore/utils/statics.js b/labscore/utils/statics.js index f1b9dd5..326dbbb 100644 --- a/labscore/utils/statics.js +++ b/labscore/utils/statics.js @@ -68,6 +68,10 @@ const Statics = Object.freeze({ file: "brands/google.png", revision: 2 }, + googlecalculator: { + file: "brands/googlecalculator.png", + revision: 2 + }, googledictionary: { file: "brands/googledictionary.png", revision: 0 @@ -238,6 +242,7 @@ module.exports.STATICS = Object.freeze({ genius: staticAsset(Statics.brands.genius), google: staticAsset(Statics.brands.google), googlelens: staticAsset(Statics.brands.googlelens), + googlecalculator: staticAsset(Statics.brands.googlecalculator), googledictionary: staticAsset(Statics.brands.googledictionary), googlefinance: staticAsset(Statics.brands.googlefinance), googlemaps: staticAsset(Statics.brands.googlemaps),