File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
packages/discord.js/src/structures Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -781,11 +781,17 @@ class Message extends Base {
781781 */
782782 get pinnable ( ) {
783783 const { channel } = this ;
784- return Boolean (
785- ! this . system &&
786- ( ! this . guild ||
787- ( channel ?. viewable &&
788- channel ?. permissionsFor ( this . client . user ) ?. has ( PermissionFlagsBits . ManageMessages , false ) ) ) ,
784+
785+ if ( this . system ) return false ;
786+ if ( ! this . guild ) return true ;
787+ if ( ! channel ?. viewable ) return false ;
788+
789+ const permissions = channel ?. permissionsFor ( this . client . user ) ;
790+ if ( ! permissions ) return false ;
791+
792+ return (
793+ permissions . has ( [ PermissionFlagsBits . ReadMessageHistory , PermissionFlagsBits . PinMessages ] ) ||
794+ permissions . has ( [ PermissionFlagsBits . ReadMessageHistory , PermissionFlagsBits . ManageMessages ] )
789795 ) ;
790796 }
791797
You can’t perform that action at this time.
0 commit comments