Capture YouTube titles from Discord's embed cache
This commit is contained in:
@@ -34,6 +34,8 @@ export interface ExtractedMedia {
|
||||
previewUrl: string | null;
|
||||
/** Embed title, when Discord provides one (YouTube and friends). Null elsewhere. */
|
||||
title: string | null;
|
||||
/** Embed author (the YouTube channel Discord shows). Null elsewhere. */
|
||||
titleAuthor: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,7 +97,8 @@ function extractEmbed(embed: CoreEmbed): ExtractedMedia | null {
|
||||
width: embed.width ?? null,
|
||||
height: embed.height ?? null,
|
||||
durationSecs: null,
|
||||
title: embed.title ?? null
|
||||
title: embed.title ?? null,
|
||||
titleAuthor: embed.authorName ?? null
|
||||
};
|
||||
|
||||
if (embed.videoUrl) {
|
||||
@@ -150,7 +153,8 @@ function extractSticker(sticker: CoreSticker): ExtractedMedia | null {
|
||||
durationSecs: null,
|
||||
downloaded: false,
|
||||
previewUrl: null,
|
||||
title: null
|
||||
title: null,
|
||||
titleAuthor: null
|
||||
};
|
||||
}
|
||||
|
||||
@@ -178,7 +182,8 @@ function extractFrom(message: MediaMessage): ExtractedMedia[] {
|
||||
: null,
|
||||
downloaded: false,
|
||||
previewUrl: null,
|
||||
title: null
|
||||
title: null,
|
||||
titleAuthor: null
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user