feat: Update

This commit is contained in:
March 7th
2022-11-15 20:06:03 +07:00
parent 0b17709471
commit 1adbddceda
6 changed files with 139 additions and 78 deletions

View File

@@ -1,6 +1,7 @@
'use strict';
const { Presence } = require('./Presence');
const { CustomStatus } = require('./RichPresence');
const { TypeError } = require('../errors');
const { Opcodes, ActivityTypes } = require('../util/Constants');
@@ -48,7 +49,9 @@ class ClientPresence extends Presence {
};
if (activities?.length) {
for (const [i, activity] of activities.entries()) {
if (typeof activity.name !== 'string') throw new TypeError('INVALID_TYPE', `activities[${i}].name`, 'string');
if (!(activity instanceof CustomStatus) && typeof activity.name !== 'string') {
throw new TypeError('INVALID_TYPE', `activities[${i}].name`, 'string');
}
activity.type ??= 0;
data.activities.push(
Object.assign(activity, {

View File

@@ -364,7 +364,7 @@ class ClientUser extends User {
* @typedef {Object} PresenceData
* @property {PresenceStatusData} [status] Status of the user
* @property {boolean} [afk] Whether the user is AFK
* @property {ActivitiesOptions[]} [activities] Activity the user is playing
* @property {Array[ActivitiesOptions|CustomStatus|RichPresence|SpotifyRPC]} [activities] Activity the user is playing
* @property {number|number[]} [shardId] Shard id(s) to have the activity set on
*/

View File

@@ -77,6 +77,18 @@ class CustomStatus {
state: this.state,
};
}
/**
* When concatenated with a string, this automatically returns the activities' name instead of the Activity object.
* @returns {string}
*/
toString() {
return this.name;
}
_clone() {
return Object.assign(Object.create(this), this);
}
}
class RichPresence {
@@ -520,6 +532,18 @@ https://github.com/aiko-chan-ai/discord.js-selfbot-v13/blob/main/Documents/RichP
});
return res;
}
/**
* When concatenated with a string, this automatically returns the activities' name instead of the Activity object.
* @returns {string}
*/
toString() {
return this.name;
}
_clone() {
return Object.assign(Object.create(this), this);
}
}
/**