Store embed titles and search them
This commit is contained in:
@@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user