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