Merge pull request #233 from yazninja/upcoming
[WIP] DiscordRPC - Add Open in Apple Music Button
This commit is contained in:
commit
958e1c9977
1 changed files with 3 additions and 2 deletions
|
@ -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) + '...'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue