Skip to content

Commit

Permalink
fix(Message): update getters to take null permissions into account (#…
Browse files Browse the repository at this point in the history
…5066)

* fix(Message): update message#delete

* refactor(Message): message#deletable avoid duplicate call

* Update Message.js

* fix(message): resolve syntax errors

* chore(message): resolve linting issues (death to the gh web panel)

* Update Message.js

* death to the github web panel

* Update src/structures/Message.js

Co-authored-by: Jan <66554238+Vaporox@users.noreply.github.com>

Co-authored-by: Jan <66554238+Vaporox@users.noreply.github.com>
  • Loading branch information
Zaid and vaporoxx committed Jan 22, 2021
1 parent eb28ee7 commit 98b1c58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/structures/Message.js
Expand Up @@ -386,10 +386,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.channel.permissionsFor?.(this.client.user)?.has(Permissions.FLAGS.MANAGE_MESSAGES)),
);
}

Expand Down

0 comments on commit 98b1c58

Please sign in to comment.