mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-07 21:53:07 -04:00
add new search types
This commit is contained in:
parent
edd2ef52d2
commit
adbc3a9d33
2 changed files with 58 additions and 0 deletions
|
@ -33,6 +33,10 @@ const SEARCH_CARD_TYPES = {
|
||||||
DICTIONARY: 7,
|
DICTIONARY: 7,
|
||||||
FUNBOX_COIN_FLIP: 10,
|
FUNBOX_COIN_FLIP: 10,
|
||||||
FUNBOX_COLOR_PICKER: 11,
|
FUNBOX_COLOR_PICKER: 11,
|
||||||
|
DATA_GENERIC: 20,
|
||||||
|
DATA_FINANCE: 21,
|
||||||
|
DATA_DICTIONARY: 22,
|
||||||
|
DATA_TRANSLATE: 23
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: create a favicon() util
|
// TODO: create a favicon() util
|
||||||
|
@ -163,6 +167,24 @@ function createSearchResultPage(context, result, doodle){
|
||||||
footer: renderFooter(context, doodle)
|
footer: renderFooter(context, doodle)
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
|
case SEARCH_CARD_TYPES.DATA_GENERIC:
|
||||||
|
res = createEmbed("default", context, {
|
||||||
|
description: `-# ${result.fact.category} › **${result.fact.type}**\n# ${result.fact.result}`,
|
||||||
|
footer: renderFooter(context, doodle)
|
||||||
|
})
|
||||||
|
|
||||||
|
if(result.fact.icon) res.thumbnail = { url: result.fact.icon }
|
||||||
|
|
||||||
|
break;
|
||||||
|
case SEARCH_CARD_TYPES.DATA_FINANCE:
|
||||||
|
res = createEmbed("default", context, {
|
||||||
|
description: `-# $${result.finance.ticker} (${result.finance.exchange})\n${result.finance.title}\n# ${result.finance.price}$\n**${result.finance.change}**`,
|
||||||
|
footer: {
|
||||||
|
// TODO: googlefinance Static Asset
|
||||||
|
iconUrl: STATICS.google,
|
||||||
|
text: `${result.finance.time} • Google Finance • ${context.application.name}`
|
||||||
|
}
|
||||||
|
})
|
||||||
default:
|
default:
|
||||||
res = createEmbed("error", context, "Unknown GoogleResult Type: " + result.type)
|
res = createEmbed("error", context, "Unknown GoogleResult Type: " + result.type)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -23,6 +23,7 @@ function renderFooter(context, doodle){
|
||||||
}
|
}
|
||||||
|
|
||||||
// These have to be synced with the backend (search_service/endpoints/google).
|
// These have to be synced with the backend (search_service/endpoints/google).
|
||||||
|
|
||||||
const SEARCH_CARD_TYPES = {
|
const SEARCH_CARD_TYPES = {
|
||||||
UNKNONW: 0,
|
UNKNONW: 0,
|
||||||
SEARCH_RESULT: 1,
|
SEARCH_RESULT: 1,
|
||||||
|
@ -34,6 +35,10 @@ const SEARCH_CARD_TYPES = {
|
||||||
DICTIONARY: 7,
|
DICTIONARY: 7,
|
||||||
FUNBOX_COIN_FLIP: 10,
|
FUNBOX_COIN_FLIP: 10,
|
||||||
FUNBOX_COLOR_PICKER: 11,
|
FUNBOX_COLOR_PICKER: 11,
|
||||||
|
DATA_GENERIC: 20,
|
||||||
|
DATA_FINANCE: 21,
|
||||||
|
DATA_DICTIONARY: 22,
|
||||||
|
DATA_TRANSLATE: 23
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: create a favicon() util
|
// TODO: create a favicon() util
|
||||||
|
@ -163,6 +168,37 @@ function createSearchResultPage(context, result, doodle){
|
||||||
},
|
},
|
||||||
footer: renderFooter(context, doodle)
|
footer: renderFooter(context, doodle)
|
||||||
})
|
})
|
||||||
|
break;
|
||||||
|
case SEARCH_CARD_TYPES.DATA_GENERIC:
|
||||||
|
res = createEmbed("default", context, {
|
||||||
|
description: `-# ${result.fact.category} > ${result.fact.type}\n# ${result.fact.result}`,
|
||||||
|
thumbnail: {
|
||||||
|
url: result.card.thumbnail
|
||||||
|
},
|
||||||
|
footer: renderFooter(context, doodle)
|
||||||
|
})
|
||||||
|
|
||||||
|
if(result.fact.icon) res.thumbnail = { url: result.fact.icon }
|
||||||
|
break;
|
||||||
|
case SEARCH_CARD_TYPES.DATA_GENERIC:
|
||||||
|
res = createEmbed("default", context, {
|
||||||
|
description: `-# ${result.fact.category} › **${result.fact.type}**\n# ${result.fact.result}`,
|
||||||
|
footer: renderFooter(context, doodle)
|
||||||
|
})
|
||||||
|
|
||||||
|
if(result.fact.icon) res.thumbnail = { url: result.fact.icon }
|
||||||
|
|
||||||
|
break;
|
||||||
|
case SEARCH_CARD_TYPES.DATA_FINANCE:
|
||||||
|
res = createEmbed("default", context, {
|
||||||
|
description: `-# $${result.finance.ticker} (${result.finance.exchange})\n${result.finance.title}\n# ${result.finance.price}$\n**${result.finance.change}**`,
|
||||||
|
footer: {
|
||||||
|
// TODO: googlefinance Static Asset
|
||||||
|
iconUrl: STATICS.google,
|
||||||
|
text: `${result.finance.time} • Google Finance • ${context.application.name}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
res = createEmbed("error", context, "Unknown GoogleResult Type: " + result.type)
|
res = createEmbed("error", context, "Unknown GoogleResult Type: " + result.type)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue