fix(Docs): Missing methods

This commit is contained in:
March 7th 2022-07-07 02:12:21 +07:00
parent a8a9528a28
commit 6ccf6ec8f3
2 changed files with 15 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -448,6 +448,11 @@ class SpotifyRPC extends RichPresence {
match: crypto.randomBytes(20).toString('hex'), match: crypto.randomBytes(20).toString('hex'),
}; };
} }
/**
* Set the large image of this activity
* @param {?string} image Spotify song's image ID
* @returns {SpotifyRPC}
*/
setAssetsLargeImage(image) { setAssetsLargeImage(image) {
if (image.startsWith('spotify:')) image = image.replace('spotify:', ''); if (image.startsWith('spotify:')) image = image.replace('spotify:', '');
if (!(this.assets instanceof Object)) { if (!(this.assets instanceof Object)) {
@ -459,6 +464,11 @@ class SpotifyRPC extends RichPresence {
} }
return this; return this;
} }
/**
* Set the small image of this activity
* @param {?string} image Spotify song's image ID
* @returns {RichPresence}
*/
setAssetsSmallImage(image) { setAssetsSmallImage(image) {
if (image.startsWith('spotify:')) image = image.replace('spotify:', ''); if (image.startsWith('spotify:')) image = image.replace('spotify:', '');
if (!(this.assets instanceof Object)) { if (!(this.assets instanceof Object)) {
@ -480,6 +490,10 @@ class SpotifyRPC extends RichPresence {
return this; return this;
} }
/**
* Convert the rich presence to a JSON object
* @returns {SpotifyRPC}
*/
toJSON() { toJSON() {
if (!this.sync_id) throw new Error('Song id is required'); if (!this.sync_id) throw new Error('Song id is required');
return { return {