Fix Discord RPC album length < 2

This commit is contained in:
Will Hurley 2024-08-01 12:10:37 +01:00
parent 65f3b251f4
commit ffcb563b35

View File

@ -60,8 +60,13 @@ const getActivity = (): Presence => {
presence.state = mediaInfo.artists ? mediaInfo.artists : "unknown artist(s)"; presence.state = mediaInfo.artists ? mediaInfo.artists : "unknown artist(s)";
presence.largeImageKey = mediaInfo.image; presence.largeImageKey = mediaInfo.image;
if (mediaInfo.album) { if (mediaInfo.album) {
if (mediaInfo.album.length < 2) { // Fix for DiscordRPC 2 character minimum
presence.largeImageText = mediaInfo.album + " ";
}
else {
presence.largeImageText = mediaInfo.album; presence.largeImageText = mediaInfo.album;
} }
}
presence.buttons = [{ label: buttonText, url: mediaInfo.url }]; presence.buttons = [{ label: buttonText, url: mediaInfo.url }];
} else { } else {
presence.details = `Watching ${mediaInfo.title}`; presence.details = `Watching ${mediaInfo.title}`;