added toggle for song.link button in discord rpc (#1435)

* Add song.link

* added toggle for song.link button for discord rpc

Co-authored-by: Charles Surett <surettcharles@gmail.com>
This commit is contained in:
UnbreakCode 2022-09-15 14:43:15 +02:00 committed by GitHub
parent 57edd48b1f
commit 9cb864b971
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 1 deletions

View file

@ -233,11 +233,13 @@ export default class DiscordRPC {
*/
private filterActivity(activity: any, attributes: any): Object {
// Add the buttons if people want them
const showSongLink = this._utils.getStoreValue("connectivity.discord_rpc.show_songlink");
if (!this._utils.getStoreValue("connectivity.discord_rpc.hide_buttons")) {
activity.buttons = [
{ label: "Listen on Cider", url: attributes.url.cider },
{ label: "View on Apple Music", url: attributes.url.appleMusic },
]; //To change attributes.url => preload/cider-preload.js
... showSongLink ? [{label: "Song.link", url: 'https://song.link/i/' + attributes.songId}] : []
]; //To change attributes.url => preload/cider-preload.js
}
// Add the timestamp if its playing and people want them