Store embed titles and search them

This commit is contained in:
Fisto
2026-09-17 13:10:16 +02:00
parent c6caa168be
commit 557ba5ca7e
13 changed files with 200 additions and 10 deletions
+8 -3
View File
@@ -32,6 +32,8 @@ export interface ExtractedMedia {
/** False for every embed. Downloads are a later step, never for third-party embeds. */
downloaded: boolean;
previewUrl: string | null;
/** Embed title, when Discord provides one (YouTube and friends). Null elsewhere. */
title: string | null;
}
function extension(filename: string | null | undefined): string {
@@ -81,7 +83,8 @@ function extractEmbed(embed: CoreEmbed): ExtractedMedia | null {
size: null,
width: embed.width ?? null,
height: embed.height ?? null,
durationSecs: null
durationSecs: null,
title: embed.title ?? null
};
if (embed.videoUrl) {
@@ -135,7 +138,8 @@ function extractSticker(sticker: CoreSticker): ExtractedMedia | null {
height: null,
durationSecs: null,
downloaded: false,
previewUrl: null
previewUrl: null,
title: null
};
}
@@ -162,7 +166,8 @@ function extractFrom(message: MediaMessage): ExtractedMedia[] {
? attachment.durationSecs
: null,
downloaded: false,
previewUrl: null
previewUrl: null,
title: null
});
}