@@ -115,7 +115,7 @@ class ClientApplication extends Application {
|
||||
*/
|
||||
this.popularCommands = new Collection();
|
||||
data.popular_application_command_ids.forEach(id => {
|
||||
this.popularCommands.set(id, this.commands.cache.get(id));
|
||||
this.popularCommands.set(id, this.commands?.cache?.get(id));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -147,10 +147,11 @@ class ClientApplication extends Application {
|
||||
const app = await this.client.api.oauth2.authorize.get({
|
||||
query: {
|
||||
client_id: this.id,
|
||||
scope: 'bot',
|
||||
scope: 'bot applications.commands',
|
||||
},
|
||||
});
|
||||
this.client.users._add(app.bot);
|
||||
const user = this.client.users._add(app.bot);
|
||||
user._partial = false;
|
||||
this._patch(app.application);
|
||||
return this;
|
||||
}
|
||||
|
@@ -77,6 +77,13 @@ class ClientUser extends User {
|
||||
if ('bio' in data) {
|
||||
this.bio = data.bio;
|
||||
}
|
||||
|
||||
/**
|
||||
* The friend nicknames cache of the client user.
|
||||
* @type {Collection<Snowflake, string>}
|
||||
* @private
|
||||
*/
|
||||
this.friendNicknames = new Collection();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -29,12 +29,6 @@ class PartialGroupDMChannel extends Channel {
|
||||
*/
|
||||
this.icon = null;
|
||||
|
||||
/**
|
||||
* The recipients of this Group DM Channel.
|
||||
* @type {Collection<Snowflake, User>}
|
||||
*/
|
||||
this.recipients = null;
|
||||
|
||||
/**
|
||||
* Messages data
|
||||
* @type {Collection}
|
||||
@@ -68,6 +62,18 @@ class PartialGroupDMChannel extends Channel {
|
||||
this._patch(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* The recipients of this Group DM Channel.
|
||||
* @type {Collection<Snowflake, User>}
|
||||
* @readonly
|
||||
*/
|
||||
get recipients() {
|
||||
const collect = new Collection();
|
||||
this._recipients.map(recipient => collect.set(recipient.id, this.client.users._add(recipient)));
|
||||
collect.set(this.client.user.id, this.client.user);
|
||||
return collect;
|
||||
}
|
||||
|
||||
/**
|
||||
* The owner of this Group DM Channel
|
||||
* @type {?User}
|
||||
@@ -85,8 +91,7 @@ class PartialGroupDMChannel extends Channel {
|
||||
_patch(data) {
|
||||
super._patch(data);
|
||||
if ('recipients' in data) {
|
||||
this.recipients = new Collection();
|
||||
data.recipients.map(recipient => this.recipients.set(recipient.id, this.client.users._add(recipient)));
|
||||
this._recipients = data.recipients;
|
||||
}
|
||||
if ('last_pin_timestamp' in data) {
|
||||
const date = new Date(data.last_pin_timestamp);
|
||||
|
@@ -196,6 +196,15 @@ class User extends Base {
|
||||
return this.client.user.notes.get(this.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get friend nickname
|
||||
* @type {?string}
|
||||
* @readonly
|
||||
*/
|
||||
get nickname() {
|
||||
return this.client.user.friendNicknames.get(this.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* The voice state of this member
|
||||
* @type {VoiceState}
|
||||
@@ -282,6 +291,16 @@ class User extends Base {
|
||||
return this.client.relationships.addFriend(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the nickname of the friend
|
||||
* @param {?string} nickname The nickname to change
|
||||
* @type {boolean}
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
setNickname(nickname) {
|
||||
return this.client.user.setNickname(this.id, nickname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Friend Request to the user
|
||||
* @type {boolean}
|
||||
|
Reference in New Issue
Block a user