Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Message#bulkDeletable #8760

Merged
merged 9 commits into from
Nov 6, 2022
Merged
9 changes: 9 additions & 0 deletions packages/discord.js/src/structures/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,15 @@ class Message extends Base {
);
}

/**
* Whether the message is bulk deletable by the client user
* @type {boolean}
* @readonly
*/
get bulkDeletable() {
return this.deletable && Date.now() - this.createdTimestamp < 1_209_600_000;
}

/**
* Whether the message is pinnable by the client user
* @type {boolean}
Expand Down
1 change: 1 addition & 0 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1692,6 +1692,7 @@ export class Message<InGuild extends boolean = boolean> extends Base {
public applicationId: Snowflake | null;
public attachments: Collection<Snowflake, Attachment>;
public author: User;
public get bulkDeletable(): boolean;
public get channel(): If<InGuild, GuildTextBasedChannel, TextBasedChannel>;
public channelId: Snowflake;
public get cleanContent(): string;
Expand Down