mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-07 21:53:07 -04:00
[nextgen/cardstack] migrate google, google images to cardstack
This commit is contained in:
parent
ba7c76ff04
commit
0433c3a785
6 changed files with 95 additions and 91 deletions
|
@ -37,8 +37,8 @@ function renderAnimeResultsPage(context, res, includeSupplementalData = true){
|
|||
if(res.subtype) result.description += pill(OMNI_ANIME_FORMAT_TYPES[res.subtype]) + " "
|
||||
else result.description += pill(OMNI_ANIME_FORMAT_TYPES[res.type]) + " "
|
||||
}
|
||||
if(res.genres) result.description += res.genres.map((r)=>smallPill(r)).join(" ") + "\n";
|
||||
if(res.tags) result.description += "-# " + res.tags.map((t)=>smallPill(t)).join(" ") + "\n\n";
|
||||
if(res.genres?.length) result.description += res.genres.splice(0,3).map((r)=>smallPill(r)).join(" ") + "\n";
|
||||
if(res.tags?.length) result.description += "-# " + res.tags.map((t)=>smallPill(t)).join(" ") + "\n\n";
|
||||
if(res.description) result.description += stringwrapPreserveWords(res.description, 600);
|
||||
if(res.attribution?.description) result.description += `\n\n-# Source • ${res.attribution.description}`
|
||||
|
||||
|
|
|
@ -8,7 +8,12 @@ const { favicon } = require("#utils/markdown");
|
|||
const {editOrReply} = require('#utils/message')
|
||||
const {STATICS} = require('#utils/statics')
|
||||
|
||||
const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require('detritus-client/lib/constants');
|
||||
const {
|
||||
ApplicationCommandOptionTypes,
|
||||
InteractionContextTypes,
|
||||
ApplicationIntegrationTypes
|
||||
} = require('detritus-client/lib/constants');
|
||||
const {createDynamicCardStack} = require("#cardstack/index");
|
||||
|
||||
function createImageResultPage(context, result) {
|
||||
let res = page(createEmbed("default", context, {
|
||||
|
@ -72,9 +77,9 @@ module.exports = {
|
|||
}
|
||||
|
||||
if (!pages.length) return editOrReply(context, createEmbed("warning", context, `No results found.`))
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
|
||||
return await createDynamicCardStack(context, {
|
||||
cards: pages
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
|
|
|
@ -10,6 +10,7 @@ const { editOrReply } = require('#utils/message')
|
|||
const { STATICS } = require('#utils/statics')
|
||||
|
||||
const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require('detritus-client/lib/constants');
|
||||
const {createDynamicCardStack} = require("#cardstack/index");
|
||||
|
||||
function renderFooter(context, doodle){
|
||||
if(doodle.super_g) return {
|
||||
|
@ -292,9 +293,8 @@ module.exports = {
|
|||
|
||||
if(!pages.length) return editOrReply(context, createEmbed("warning", context, `No results found.`))
|
||||
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
return await createDynamicCardStack(context, {
|
||||
cards: pages
|
||||
});
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
|
|
|
@ -36,8 +36,8 @@ function renderAnimeResultsPage(context, res, includeSupplementalData = true){
|
|||
if(res.subtype) result.description += pill(OMNI_ANIME_FORMAT_TYPES[res.subtype]) + " "
|
||||
else result.description += pill(OMNI_ANIME_FORMAT_TYPES[res.type]) + " "
|
||||
}
|
||||
if(res.genres) result.description += res.genres.splice(0,3).map((r)=>smallPill(r)).join(" ") + "\n";
|
||||
if(res.tags) result.description += "-# " + res.tags.map((t)=>smallPill(t)).join(" ") + "\n\n";
|
||||
if(res.genres?.length) result.description += res.genres.splice(0,3).map((r)=>smallPill(r)).join(" ") + "\n";
|
||||
if(res.tags?.length) result.description += "-# " + res.tags.map((t)=>smallPill(t)).join(" ") + "\n\n";
|
||||
if(res.description) result.description += stringwrapPreserveWords(res.description, 600);
|
||||
if(res.attribution?.description) result.description += `\n\n-# Source • ${res.attribution.description}`
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const { googleImages } = require('#api');
|
||||
const { paginator } = require('#client');
|
||||
const {createDynamicCardStack} = require("#cardstack/index");
|
||||
const { PERMISSION_GROUPS } = require('#constants');
|
||||
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed');
|
||||
const { createEmbed, page } = require('#utils/embed');
|
||||
const { acknowledge } = require('#utils/interactions');
|
||||
const { favicon } = require("#utils/markdown");
|
||||
const { editOrReply } = require('#utils/message')
|
||||
|
@ -57,9 +57,8 @@ module.exports = {
|
|||
|
||||
if (!pages.length) return editOrReply(context, createEmbed("warning", context, `No results found.`))
|
||||
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
return await createDynamicCardStack(context, {
|
||||
cards: pages
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
|
|
|
@ -8,6 +8,7 @@ const { acknowledge } = require('#utils/interactions');
|
|||
const { link, citation, icon, codeblock, pill, smallPill, favicon} = require('#utils/markdown')
|
||||
const { editOrReply } = require('#utils/message')
|
||||
const { STATICS } = require('#utils/statics')
|
||||
const {createDynamicCardStack} = require("#cardstack/index");
|
||||
|
||||
function renderFooter(context, doodle){
|
||||
if(doodle?.super_g) return {
|
||||
|
@ -283,9 +284,8 @@ module.exports = {
|
|||
|
||||
if(!pages.length) return editOrReply(context, createEmbed("warning", context, `No results found.`))
|
||||
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
return await createDynamicCardStack(context, {
|
||||
cards: pages
|
||||
});
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue