This commit is contained in:
Elysia 2023-06-21 11:57:21 +07:00
parent a176df7e20
commit aa749efa64
3 changed files with 24 additions and 14 deletions

View File

@ -617,7 +617,7 @@ class ClientUser extends User {
/**
* Set pronouns
* @param {string | null} pronouns
* @param {?string} pronouns Your pronouns
* @returns {Promise<ClientUser>}
*/
setPronouns(pronouns = '') {

View File

@ -54,33 +54,29 @@ class User extends Base {
* Time that User has nitro (Unix Timestamp)
* <info>The user must be force fetched for this property to be present or be updated</info>
* @type {?number}
* @readonly
*/
this.premiumSince = null;
/**
* Time that User has nitro and boost server (Unix Timestamp)
* @type {?number}
* @readonly
*/
this.premiumGuildSince = null;
/**
* About me (User)
* <info>The user must be force fetched for this property to be present or be updated</info>
* @type {?string}
* @readonly
*/
this.bio = null;
/**
* This user is on the same servers as Client User
* Pronouns (User)
* <info>The user must be force fetched for this property to be present or be updated</info>
* @type {Collection<Snowflake, Guild>}
* @readonly
* @type {?string}
*/
this.mutualGuilds = new Collection();
this.pronouns = null;
this._mutualGuilds = [];
/**
* [Bot] Application
* @type {?ClientApplication}
* @readonly
*/
this.application = application ? new ClientApplication(this.client, application, this) : null;
this._partial = true;
@ -202,6 +198,16 @@ class User extends Base {
}
}
/**
* This user is on the same servers as Client User
* <info>The user must be force fetched for this property to be present or be updated</info>
* @type {Collection<Snowflake, Guild>}
* @readonly
*/
get mutualGuilds() {
return new Collection(this._mutualGuilds.map(obj => [obj.id, obj]));
}
/**
* Get all mutual friends (Client -> User)
* @type {Promise<Collection<Snowflake, User>>}
@ -335,7 +341,9 @@ class User extends Base {
// Unknown
}
this.mutualGuilds = new Collection(data.mutual_guilds.map(obj => [obj.id, obj]));
if ('mutual_guilds' in data) {
this._mutualGuilds = data.mutual_guilds;
}
}
/**

10
typings/index.d.ts vendored
View File

@ -1090,6 +1090,7 @@ export class ClientUser extends User {
public readonly emailAddress: string;
public stopRinging(channel: ChannelResolvable): Promise<void>;
public setGlobalName(globalName?: string): Promise<this>;
public setPronouns(pronouns?: string): Promise<this>;
}
type NitroType = 'NONE' | 'NITRO_CLASSIC' | 'NITRO_BOOST' | 'NITRO_BASIC';
@ -3256,6 +3257,7 @@ export class User extends PartialTextBasedChannel(Base) {
public avatarDecoration: string | null;
public banner: string | null | undefined;
public bot: boolean;
public pronouns: string | null;
public readonly createdAt: Date;
public readonly relationships: RelationshipTypes;
public readonly createdTimestamp: number;
@ -3275,10 +3277,10 @@ export class User extends PartialTextBasedChannel(Base) {
public username: string;
public readonly note: string | null;
public readonly nickname: string | null;
public readonly connectedAccounts: object[];
public readonly premiumSince: Date;
public readonly premiumGuildSince: Date;
public readonly bio: string | null;
public connectedAccounts: object[];
public premiumSince: Date;
public premiumGuildSince: Date;
public bio: string | null;
public readonly mutualGuilds: Collection<Snowflake, object>;
public readonly mutualFriends: Promise<Collection<Snowflake, User>>;
public readonly voice: VoiceState;