mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
Partials (#3070)
* Remove GroupDMChannels they sparked no joy * Start partials for message deletion * MessageUpdate partials * Add partials as an opt-in client option * Add fetch() to Message * Message.author should never be undefined * Fix channels being the wrong type * Allow fetching channels * Refactor and add reaction add partials * Reaction remove partials * Check for emoji first * fix message fetching janky * User partials in audit logs * refactor overwrite code * guild member partials * partials as a whitelist * document GuildMember#fetch * fix: check whether a structure is a partial, not whether cache is true * typings: Updated for latest commit (#3075) * partials: fix messageUpdate behaviour (now "old" message can be partial) * partials: add warnings and docs * partials: add partials to index.yml * partials: tighten "partial" definitions * partials: fix embed-only messages counting as partials
This commit is contained in:
@@ -28,7 +28,7 @@ class GuildMember extends Base {
|
||||
* The user that this guild member instance represents
|
||||
* @type {User}
|
||||
*/
|
||||
this.user = {};
|
||||
if (data.user) this.user = client.users.add(data.user, true);
|
||||
|
||||
/**
|
||||
* The timestamp the member joined the guild at
|
||||
@@ -79,6 +79,14 @@ class GuildMember extends Base {
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this GuildMember is a partial
|
||||
* @type {boolean}
|
||||
*/
|
||||
get partial() {
|
||||
return !this.joinedTimestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* A collection of roles that are applied to this member, mapped by the role ID
|
||||
* @type {GuildMemberRoleStore<Snowflake, Role>}
|
||||
@@ -355,6 +363,14 @@ class GuildMember extends Base {
|
||||
return this.guild.members.ban(this, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches this GuildMember.
|
||||
* @returns {Promise<GuildMember>}
|
||||
*/
|
||||
fetch() {
|
||||
return this.guild.members.fetch(this.id, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* When concatenated with a string, this automatically returns the user's mention instead of the GuildMember object.
|
||||
* @returns {string}
|
||||
|
||||
Reference in New Issue
Block a user