From 8ae56a3d70477e1068f008485cb604f4856d6eb5 Mon Sep 17 00:00:00 2001 From: AiraNadih <128119996+AiraNadih@users.noreply.github.com> Date: Thu, 28 Aug 2025 22:17:14 +0800 Subject: [PATCH] fix(route/kemono): sort discord messages newest first and fix image urls (#19922) * fix(route/kemono): sort discord messages newest first and fix image urls * feat(radar): add radar for kemono discord route --------- Co-authored-by: AiraNadih --- lib/routes/kemono/index.ts | 5 +++++ lib/routes/kemono/templates/discord.art | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/routes/kemono/index.ts b/lib/routes/kemono/index.ts index 659a48d16..bf099fc18 100644 --- a/lib/routes/kemono/index.ts +++ b/lib/routes/kemono/index.ts @@ -46,6 +46,10 @@ export const route: Route = { source: ['kemono.cr/:source/user/:id/fancards'], target: '/:source/:id/fancards', }, + { + source: ['kemono.cr/discord/server/:id'], + target: '/discord/:id', + }, ], name: 'Posts', maintainers: ['nczitzk', 'AiraNadih'], @@ -197,6 +201,7 @@ async function processDiscordMessages(channels: any[], limit: number) { return channelResponse.data .filter((message: DiscordMessage) => message.content || message.attachments) + .sort((a, b) => b.id.localeCompare(a.id)) .slice(0, limit) .map((message: DiscordMessage) => ({ title: message.content || 'Discord Message', diff --git a/lib/routes/kemono/templates/discord.art b/lib/routes/kemono/templates/discord.art index 23550ae4a..c7da459b3 100644 --- a/lib/routes/kemono/templates/discord.art +++ b/lib/routes/kemono/templates/discord.art @@ -4,7 +4,7 @@ {{ if i.attachments }} {{ each i.attachments a }} - + {{ /each }} {{ /if }}