rpc library images working now
This commit is contained in:
parent
2141d9aa0b
commit
5c56dfbcc3
1 changed files with 6 additions and 4 deletions
|
@ -9,6 +9,7 @@ export default class DiscordRichPresence {
|
||||||
*/
|
*/
|
||||||
private static _store: any;
|
private static _store: any;
|
||||||
private _app : any;
|
private _app : any;
|
||||||
|
private _attributes : any;
|
||||||
private static _connection: boolean = false;
|
private static _connection: boolean = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,7 +149,7 @@ export default class DiscordRichPresence {
|
||||||
state: `${attributes.artistName ? `by ${attributes.artistName}` : ''}`,
|
state: `${attributes.artistName ? `by ${attributes.artistName}` : ''}`,
|
||||||
startTimestamp: attributes.startTime,
|
startTimestamp: attributes.startTime,
|
||||||
endTimestamp: attributes.endTime,
|
endTimestamp: attributes.endTime,
|
||||||
largeImageKey: attributes.artwork.url.replace('{w}', '1024').replace('{h}', '1024'),
|
largeImageKey: attributes?.artwork?.url?.replace('{w}', '1024').replace('{h}', '1024'),
|
||||||
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: [
|
||||||
|
@ -217,9 +218,8 @@ export default class DiscordRichPresence {
|
||||||
})
|
})
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(function(json){
|
.then(function(json){
|
||||||
self._activity['largeImageKey'] = json.url
|
self._attributes["artwork"]["url"] = json.url
|
||||||
console.log(json.url)
|
self.updateActivity(self._attributes)
|
||||||
self._client.setActivity(self._activity);
|
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -237,6 +237,7 @@ export default class DiscordRichPresence {
|
||||||
* @param attributes Music Attributes (attributes.status = current state)
|
* @param attributes Music Attributes (attributes.status = current state)
|
||||||
*/
|
*/
|
||||||
onPlaybackStateDidChange(attributes: object): void {
|
onPlaybackStateDidChange(attributes: object): void {
|
||||||
|
this._attributes = attributes
|
||||||
this.updateActivity(attributes)
|
this.updateActivity(attributes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,6 +246,7 @@ export default class DiscordRichPresence {
|
||||||
* @param attributes Music Attributes
|
* @param attributes Music Attributes
|
||||||
*/
|
*/
|
||||||
onNowPlayingItemDidChange(attributes: object): void {
|
onNowPlayingItemDidChange(attributes: object): void {
|
||||||
|
this._attributes = attributes
|
||||||
this.updateActivity(attributes)
|
this.updateActivity(attributes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue