fix: rpc
This commit is contained in:
parent
78e2fb2945
commit
3e84e501b7
@ -404,7 +404,10 @@ class Activity {
|
||||
}
|
||||
|
||||
toJSON(...props) {
|
||||
return Util.flatten(this, ...props);
|
||||
return {
|
||||
...Util.flatten(this, ...props),
|
||||
type: typeof this.type === 'number' ? this.type : ActivityTypes[this.type],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -692,7 +695,6 @@ class RichPresence extends Activity {
|
||||
* Set the large image of this activity
|
||||
* @param {?RichPresenceImage} image The large image asset's id
|
||||
* @returns {RichPresence}
|
||||
* @deprecated
|
||||
*/
|
||||
setAssetsLargeImage(image) {
|
||||
this.assets.setLargeImage(image);
|
||||
@ -703,7 +705,6 @@ class RichPresence extends Activity {
|
||||
* Set the small image of this activity
|
||||
* @param {?RichPresenceImage} image The small image asset's id
|
||||
* @returns {RichPresence}
|
||||
* @deprecated
|
||||
*/
|
||||
setAssetsSmallImage(image) {
|
||||
this.assets.setSmallImage(image);
|
||||
@ -714,7 +715,6 @@ class RichPresence extends Activity {
|
||||
* Hover text for the large image
|
||||
* @param {string} text Assets text
|
||||
* @returns {RichPresence}
|
||||
* @deprecated
|
||||
*/
|
||||
setAssetsLargeText(text) {
|
||||
this.assets.setLargeText(text);
|
||||
@ -725,7 +725,6 @@ class RichPresence extends Activity {
|
||||
* Hover text for the small image
|
||||
* @param {string} text Assets text
|
||||
* @returns {RichPresence}
|
||||
* @deprecated
|
||||
*/
|
||||
setAssetsSmallText(text) {
|
||||
this.assets.setSmallText(text);
|
||||
@ -879,6 +878,16 @@ class RichPresence extends Activity {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Secrets for rich presence joining and spectating (send-only)
|
||||
* @param {?string} join Secrets for rich presence joining
|
||||
* @returns {RichPresence}
|
||||
*/
|
||||
setJoinSecret(join) {
|
||||
this.secrets.join = join;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a button to the rich presence
|
||||
* @param {string} name The name of the button
|
||||
@ -1057,6 +1066,13 @@ class SpotifyRPC extends RichPresence {
|
||||
this.metadata.context_uri = `spotify:album:${id}`;
|
||||
return this;
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return {
|
||||
...super.toJSON({ id: false, emoji: false, platform: false, buttons: false }),
|
||||
session_id: this.presence.client.sessionId,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exports.Presence = Presence;
|
||||
|
5
typings/index.d.ts
vendored
5
typings/index.d.ts
vendored
@ -176,13 +176,9 @@ export interface RichButton {
|
||||
export class RichPresence extends Activity {
|
||||
public constructor(client: Client, data?: object);
|
||||
public metadata: RichPresenceMetadata;
|
||||
/** @deprecated */
|
||||
public setAssetsLargeImage(image?: string): this;
|
||||
/** @deprecated */
|
||||
public setAssetsLargeText(text?: string): this;
|
||||
/** @deprecated */
|
||||
public setAssetsSmallImage(image?: string): this;
|
||||
/** @deprecated */
|
||||
public setAssetsSmallText(text?: string): this;
|
||||
public setName(name?: string): this;
|
||||
public setURL(url?: string): this;
|
||||
@ -195,6 +191,7 @@ export class RichPresence extends Activity {
|
||||
public setEndTimestamp(timestamp: Date | number | null): this;
|
||||
public setButtons(...button: RichButton[]): this;
|
||||
public addButton(name: string, url: string): this;
|
||||
public setJoinSecret(join?: string): this;
|
||||
public static getExternal(
|
||||
client: Client,
|
||||
applicationId: Snowflake,
|
||||
|
Loading…
Reference in New Issue
Block a user