mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
feat: Add "deleted" property to multiple structures. (#2556)
* Add "deleted" property to "Message" structure * Add "deleted" property to Multiple structures Structures edited: - Channel - Emoji - Guild - Guild Member - Role * Update "deletable" getter * Fix ESLint "no-trailing-spaces" errors * Requested Change: Mark w/ bulkDelete
This commit is contained in:
@@ -23,6 +23,12 @@ class Channel extends Base {
|
||||
*/
|
||||
this.type = type ? type.toLowerCase() : 'unknown';
|
||||
|
||||
/**
|
||||
* Whether the channel has been deleted
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.deleted = false;
|
||||
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,12 @@ class Emoji extends Base {
|
||||
* @type {?Snowflake}
|
||||
*/
|
||||
this.id = emoji.id;
|
||||
|
||||
/**
|
||||
* Whether this emoji has been deleted
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.deleted = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,6 +50,12 @@ class Guild extends Base {
|
||||
*/
|
||||
this.presences = new PresenceStore(this.client);
|
||||
|
||||
/**
|
||||
* Whether the bot has been removed from the guild
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.deleted = false;
|
||||
|
||||
if (!data) return;
|
||||
if (data.unavailable) {
|
||||
/**
|
||||
|
||||
@@ -39,6 +39,12 @@ class GuildMember extends Base {
|
||||
*/
|
||||
this.lastMessageChannelID = null;
|
||||
|
||||
/**
|
||||
* Whether the member has been removed from the guild
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.deleted = false;
|
||||
|
||||
this._roles = [];
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
@@ -157,6 +157,12 @@ class Message extends Base {
|
||||
* @private
|
||||
*/
|
||||
this._edits = [];
|
||||
|
||||
/**
|
||||
* Whether this message has been deleted
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.deleted = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -341,9 +347,9 @@ class Message extends Base {
|
||||
* @readonly
|
||||
*/
|
||||
get deletable() {
|
||||
return this.author.id === this.client.user.id || (this.guild &&
|
||||
return !this.deleted && (this.author.id === this.client.user.id || (this.guild &&
|
||||
this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES)
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -69,6 +69,12 @@ class Role extends Base {
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.mentionable = data.mentionable;
|
||||
|
||||
/**
|
||||
* Whether the role has been deleted
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.deleted = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user