diff --git a/commands/message/search/anime.js b/commands/message/search/anime.js index f49693d..9b88e1a 100644 --- a/commands/message/search/anime.js +++ b/commands/message/search/anime.js @@ -1,10 +1,10 @@ const { anime } = require('#api'); const { paginator } = require('#client'); -const { PERMISSION_GROUPS } = require('#constants'); +const { PERMISSION_GROUPS, OMNI_ANIME_FORMAT_TYPES } = require('#constants'); const { createEmbed, formatPaginationEmbeds, page, hexToEmbedColor } = require('#utils/embed'); const { acknowledge } = require('#utils/interactions'); -const { smallPill, link } = require('#utils/markdown'); +const { smallPill, link, pill } = require('#utils/markdown'); const { editOrReply } = require('#utils/message'); function renderAnimeResultsPage(context, res){ @@ -19,8 +19,10 @@ function renderAnimeResultsPage(context, res){ // Render Description if(res.subtitle) result.description += `-# ${res.subtitle}\n\n`; + if(res.subtype) result.description += pill(OMNI_ANIME_FORMAT_TYPES[res.subtype]) + " " if(res.genres) result.description += res.genres.map((r)=>smallPill(r)).join(" ") + "\n\n"; if(res.description) result.description += res.description; + if(res.attribution?.description) result.description += `\n\n-# Source • ${res.attribution.description}` // Render Images if(res.cover) result.thumbnail = { url: res.cover }; @@ -87,6 +89,9 @@ module.exports = { pages: formatPaginationEmbeds(pages) }); }catch(e){ + if(e.response?.body?.status == 1) return editOrReply(context, createEmbed("warning", context, e.response?.body?.message)) + if(e.response?.body?.status == 2) return editOrReply(context, createEmbed("warning", context, e.response?.body?.message)) + console.log(e) return editOrReply(context, createEmbed("error", context, `Unable to perform anime search.`)) } diff --git a/labscore/constants.js b/labscore/constants.js index 5db4f69..667b35e 100644 --- a/labscore/constants.js +++ b/labscore/constants.js @@ -1663,7 +1663,7 @@ module.exports.PROVISIONAL_ACCOUNT_AVATARS = Object.freeze([ // Omnisearch // Anime Format Types (/omni_service/endpoints/anime.js) -const FORMAT_TYPES = { +module.exports.OMNI_ANIME_FORMAT_TYPES = Object.freeze({ TV: "Tv", TV_SHORT: "Tv Short", MOVIE: "Movie", @@ -1674,4 +1674,4 @@ const FORMAT_TYPES = { MANGA: "Manga", NOVEL: "Novel", ONE_SHOT: "One Shot" -} \ No newline at end of file +}) \ No newline at end of file