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}`));
|
this._client.clearActivity().catch((e: any) => console.error(`[DiscordRichPresence][clearActivity] ${e}`));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const listenURL = `https://cider.sh/p?s&id=${attributes.playParams.id}` // cider://play/s/[id] (for song)
|
const listenURL = `https://cider.sh/p?s&id=${attributes.playParams.id}` // cider://play/s/[id] (for song)
|
||||||
|
|
||||||
this._activity = {
|
this._activity = {
|
||||||
details: attributes.name,
|
details: attributes.name,
|
||||||
state: `${attributes.artistName ? `by ${attributes.artistName}` : ''}`,
|
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',
|
largeImageKey: (attributes.artwork.url.replace('{w}', '1024').replace('{h}', '1024')) ?? 'cider',
|
||||||
largeImageText: attributes.albumName,
|
largeImageText: attributes.albumName,
|
||||||
instance: false, // Whether the activity is in a game session
|
instance: false, // Whether the activity is in a game session
|
||||||
|
|
||||||
buttons: [
|
buttons: [
|
||||||
{label: "Listen on Cider", url: listenURL},
|
{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
|
// Checks if the name is greater than 128 because some songs can be that long
|
||||||
if (this._activity.details && this._activity.details.length > 128) {
|
if (this._activity.details && this._activity.details.length > 128) {
|
||||||
this._activity.details = this._activity.details.substring(0, 125) + '...'
|
this._activity.details = this._activity.details.substring(0, 125) + '...'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue