From 1f4b93cd5783acc16816fd039b050f7e8f8d47be Mon Sep 17 00:00:00 2001 From: Rodry <38259440+ImRodry@users.noreply.github.com> Date: Fri, 3 Sep 2021 14:14:06 +0100 Subject: [PATCH 1/5] fix(Message): pinnable returning false in non-DEFAULT messages --- src/structures/Message.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index 22a2e852620d..703b5505f4ce 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -571,7 +571,7 @@ class Message extends Base { */ get pinnable() { return ( - this.type === 'DEFAULT' && + ['DEFAULT', 'REPLY', 'APPLICATION_COMMAND', 'THREAD_STARTER_MESSAGE'].includes(this.type) && (!this.guild || this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES, false)) ); } From 95c0575e9bffb98e1e1b8a284b8d736f633b07ba Mon Sep 17 00:00:00 2001 From: Rodry <38259440+ImRodry@users.noreply.github.com> Date: Tue, 7 Sep 2021 14:04:11 +0100 Subject: [PATCH 2/5] fix(Message): system messages are not pinnable --- src/structures/Message.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/structures/Message.js b/src/structures/Message.js index 703b5505f4ce..b10bfeedd64f 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -573,6 +573,7 @@ class Message extends Base { return ( ['DEFAULT', 'REPLY', 'APPLICATION_COMMAND', 'THREAD_STARTER_MESSAGE'].includes(this.type) && (!this.guild || this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES, false)) + !this.system ); } From d19b14ef45402ab61b9b14c6d5367aac1c8e2498 Mon Sep 17 00:00:00 2001 From: Rodry <38259440+ImRodry@users.noreply.github.com> Date: Tue, 7 Sep 2021 14:07:14 +0100 Subject: [PATCH 3/5] fix: forgot the && --- src/structures/Message.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index b10bfeedd64f..79189f68dded 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -572,7 +572,7 @@ class Message extends Base { get pinnable() { return ( ['DEFAULT', 'REPLY', 'APPLICATION_COMMAND', 'THREAD_STARTER_MESSAGE'].includes(this.type) && - (!this.guild || this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES, false)) + (!this.guild || this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES, false)) && !this.system ); } From 5d81cdfe87691c72665106372f9f4ea52811f6fa Mon Sep 17 00:00:00 2001 From: Rodry <38259440+ImRodry@users.noreply.github.com> Date: Tue, 7 Sep 2021 20:38:17 +0100 Subject: [PATCH 4/5] fix: system check and always return a boolean on pinnable --- src/structures/Message.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index 79189f68dded..be9b73e00ee1 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -570,10 +570,9 @@ class Message extends Base { * @readonly */ get pinnable() { - return ( - ['DEFAULT', 'REPLY', 'APPLICATION_COMMAND', 'THREAD_STARTER_MESSAGE'].includes(this.type) && - (!this.guild || this.channel.permissionsFor(this.client.user).has(Permissions.FLAGS.MANAGE_MESSAGES, false)) && - !this.system + return Boolean( + !this.system && + (!this.guild || this.channel.permissionsFor(this.client.user)?.has(Permissions.FLAGS.MANAGE_MESSAGES, false)) ); } From 079f4cf31ed24f0c8299526c09ed92c0432c1d49 Mon Sep 17 00:00:00 2001 From: Rodry <38259440+ImRodry@users.noreply.github.com> Date: Tue, 7 Sep 2021 20:43:17 +0100 Subject: [PATCH 5/5] style: add trailing comma --- src/structures/Message.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Message.js b/src/structures/Message.js index be9b73e00ee1..5f7507597171 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -572,7 +572,7 @@ class Message extends Base { get pinnable() { return Boolean( !this.system && - (!this.guild || this.channel.permissionsFor(this.client.user)?.has(Permissions.FLAGS.MANAGE_MESSAGES, false)) + (!this.guild || this.channel.permissionsFor(this.client.user)?.has(Permissions.FLAGS.MANAGE_MESSAGES, false)), ); }