From 98b1c582189faee9ac40d81963008d94801f3837 Mon Sep 17 00:00:00 2001 From: Zaid Date: Fri, 22 Jan 2021 12:02:21 -0500 Subject: [PATCH] fix(Message): update getters to take null permissions into account (#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> --- src/structures/Message.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index d07e2285c..ea01220ae 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -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)), ); }