feat: Global Display Name
This commit is contained in:
parent
4f3aebf9c6
commit
8a19880820
@ -87,13 +87,22 @@ class ClientUser extends User {
|
||||
if ('bio' in data) {
|
||||
this.bio = data.bio;
|
||||
}
|
||||
if ('global_name' in data) {
|
||||
/**
|
||||
* Display name of the client user.
|
||||
* @type {?string}
|
||||
*/
|
||||
this.displayName = data.global_name;
|
||||
}
|
||||
|
||||
if (!this.friendNicknames?.size) {
|
||||
/**
|
||||
* The friend nicknames cache of the client user.
|
||||
* @type {Collection<Snowflake, string>}
|
||||
* @private
|
||||
*/
|
||||
if (!this.friendNicknames?.size) this.friendNicknames = new Collection();
|
||||
this.friendNicknames = new Collection();
|
||||
}
|
||||
|
||||
if (!this._intervalSamsungPresence) {
|
||||
this._intervalSamsungPresence = setInterval(() => {
|
||||
@ -601,6 +610,15 @@ class ClientUser extends User {
|
||||
fetchBurstCredit() {
|
||||
return this.client.api.users['@me']['burst-credits'].get().then(d => d.amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set display name
|
||||
* @param {string} displayName The new display name
|
||||
* @returns {Promise<ClientUser>}
|
||||
*/
|
||||
setDisplayName(displayName = '') {
|
||||
return this.edit({ global_name: displayName });
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ClientUser;
|
||||
|
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@ -1085,6 +1085,7 @@ export class ClientUser extends User {
|
||||
public readonly nsfwAllowed: boolean;
|
||||
public readonly emailAddress: string;
|
||||
public stopRinging(channel: ChannelResolvable): Promise<void>;
|
||||
public setDisplayName(displayName?: string): Promise<this>;
|
||||
}
|
||||
|
||||
type NitroType = 'NONE' | 'NITRO_CLASSIC' | 'NITRO_BOOST' | 'NITRO_BASIC';
|
||||
|
Loading…
Reference in New Issue
Block a user