mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 14:13:02 -04:00
add date to anime listings
This commit is contained in:
parent
f2d3427aa3
commit
256f5d054c
1 changed files with 53 additions and 2 deletions
|
@ -17,6 +17,14 @@ function renderAnimeResultsPage(context, res){
|
||||||
fields: []
|
fields: []
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Add Metadata to Title
|
||||||
|
if(res.dates){
|
||||||
|
if(res.dates.start){
|
||||||
|
if(res.dates.end && new Date(res.dates.start).getFullYear() !== new Date(res.dates.end).getFullYear()) result.author.name += ` (${new Date(res.dates.start).getFullYear()} - ${new Date(res.dates.end).getFullYear()})`
|
||||||
|
else result.author.name += ` (${new Date(res.dates.start).getFullYear()})`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Render Description
|
// Render Description
|
||||||
if(res.subtitle) result.description += `-# ${res.subtitle}\n\n`;
|
if(res.subtitle) result.description += `-# ${res.subtitle}\n\n`;
|
||||||
if(res.subtype) result.description += pill(OMNI_ANIME_FORMAT_TYPES[res.subtype]) + " "
|
if(res.subtype) result.description += pill(OMNI_ANIME_FORMAT_TYPES[res.subtype]) + " "
|
||||||
|
@ -48,7 +56,9 @@ function renderAnimeResultsPage(context, res){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return page(result);
|
return page(result, {}, {
|
||||||
|
episodes_key: res.supplemental.episodes
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -86,7 +96,48 @@ module.exports = {
|
||||||
|
|
||||||
await paginator.createPaginator({
|
await paginator.createPaginator({
|
||||||
context,
|
context,
|
||||||
pages: formatPaginationEmbeds(pages)
|
pages: formatPaginationEmbeds(pages),
|
||||||
|
interactive: {
|
||||||
|
episodes_button: {
|
||||||
|
// Button Label
|
||||||
|
label: "Episodes",
|
||||||
|
// Next to pagination or new row
|
||||||
|
inline: false,
|
||||||
|
visible: true,
|
||||||
|
condition: (page)=>{
|
||||||
|
return (page.getState("episodes_key") !== null)
|
||||||
|
},
|
||||||
|
// Will resolve all conditions at paginator creation time
|
||||||
|
precompute_conditions: true,
|
||||||
|
resolvePage: (page)=>{
|
||||||
|
// If an interactive button for this index hasn't been
|
||||||
|
// resolved yet, run this code
|
||||||
|
page.getState("episodes_key"); // -> supplemental key
|
||||||
|
|
||||||
|
/* Resolve supplemental key via api */
|
||||||
|
|
||||||
|
return [...cards];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
characters_button: {
|
||||||
|
// Button Label
|
||||||
|
label: "Characters",
|
||||||
|
// Next to pagination or new row
|
||||||
|
inline: false,
|
||||||
|
condition: (page)=>{
|
||||||
|
return (page.getState("characters_key") !== null)
|
||||||
|
},
|
||||||
|
resolvePage: (page)=>{
|
||||||
|
// If an interactive button for this index hasn't been
|
||||||
|
// resolved yet, run this code
|
||||||
|
page.getState("characters_key"); // -> supplemental key
|
||||||
|
|
||||||
|
/* Resolve supplemental key via api */
|
||||||
|
|
||||||
|
return [...cards];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}catch(e){
|
}catch(e){
|
||||||
if(e.response?.body?.status == 1) return editOrReply(context, createEmbed("warning", context, e.response?.body?.message))
|
if(e.response?.body?.status == 1) return editOrReply(context, createEmbed("warning", context, e.response?.body?.message))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue