add weather result card

This commit is contained in:
bignutty 2024-12-12 15:27:41 +01:00
parent ad5c680f86
commit 2b9904788a
2 changed files with 29 additions and 0 deletions

View file

@ -40,6 +40,7 @@ const SEARCH_CARD_TYPES = {
DATA_FINANCE: 21,
DATA_DICTIONARY: 22,
DATA_TRANSLATE: 23,
DATA_WEATHER: 24,
PIVOT_IMAGES: 100
}
@ -213,6 +214,19 @@ function createSearchResultPage(context, result, doodle){
}
})
break;
case SEARCH_CARD_TYPES.DATA_WEATHER:
res = createEmbed("default", context, {
description: `-# ${result.weather.place}\n## ${result.weather.temperature}`,
thumbnail: {
url: result.weather.icon
},
footer: {
iconUrl: STATICS.weather,
text: `Weather • ${context.application.name}`
}
})
break;
case SEARCH_CARD_TYPES.PIVOT_IMAGES:
res = createEmbed("default", context, {

View file

@ -23,6 +23,7 @@ function renderFooter(context, doodle){
// These have to be synced with the backend (search_service/endpoints/google).
const SEARCH_CARD_TYPES = {
UNKNONW: 0,
SEARCH_RESULT: 1,
@ -39,6 +40,7 @@ const SEARCH_CARD_TYPES = {
DATA_FINANCE: 21,
DATA_DICTIONARY: 22,
DATA_TRANSLATE: 23,
DATA_WEATHER: 24,
PIVOT_IMAGES: 100
}
@ -212,6 +214,19 @@ function createSearchResultPage(context, result, doodle){
}
})
break;
case SEARCH_CARD_TYPES.DATA_WEATHER:
res = createEmbed("default", context, {
description: `-# ${result.weather.place}\n## ${result.weather.temperature}`,
thumbnail: {
url: result.weather.icon
},
footer: {
iconUrl: STATICS.weather,
text: `Weather • ${context.application.name}`
}
})
break;
case SEARCH_CARD_TYPES.PIVOT_IMAGES:
res = createEmbed("default", context, {