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

fix(Message): update getters to take null permissions into account #5066

Merged
merged 8 commits into from
Jan 22, 2021
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/structures/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,10 @@ class Message extends Base {
* @readonly
*/
get deletable() {
return (
return Boolean(
!this.deleted &&
(this.author.id === this.client.user.id ||
(this.guild && this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES, false)))
(this.author.id === this.client.user.id ||
(this.guild && this.channel.permissionsFor(this.client.user)?.has(Permissions.FLAGS.MANAGE_MESSAGES, false))),
zaida04 marked this conversation as resolved.
Show resolved Hide resolved
);
}

Expand Down