Merge pull request #233 from yazninja/upcoming

[WIP] DiscordRPC - Add Open in Apple Music Button
This commit is contained in:
Core 2022-01-28 03:05:01 +00:00 committed by GitHub
commit 958e1c9977
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -101,9 +101,7 @@ export default class DiscordRichPresence {
this._client.clearActivity().catch((e: any) => console.error(`[DiscordRichPresence][clearActivity] ${e}`));
return;
}
const listenURL = `https://cider.sh/p?s&id=${attributes.playParams.id}` // cider://play/s/[id] (for song)
this._activity = {
details: attributes.name,
state: `${attributes.artistName ? `by ${attributes.artistName}` : ''}`,
@ -112,11 +110,14 @@ export default class DiscordRichPresence {
largeImageKey: (attributes.artwork.url.replace('{w}', '1024').replace('{h}', '1024')) ?? 'cider',
largeImageText: attributes.albumName,
instance: false, // Whether the activity is in a game session
buttons: [
{label: "Listen on Cider", url: listenURL},
{label: "Open In Apple Music", url: attributes.songURL},
]
};
// Checks if the name is greater than 128 because some songs can be that long
if (this._activity.details && this._activity.details.length > 128) {
this._activity.details = this._activity.details.substring(0, 125) + '...'