mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(Message): update pinnable to check for migrated guilds (#11189)
* fix(Message): update `pinnable` to check for migrated guilds * refactor: requested changes * refactor: no checkAdmin and clean up the mess
This commit is contained in:
@@ -781,11 +781,17 @@ class Message extends Base {
|
|||||||
*/
|
*/
|
||||||
get pinnable() {
|
get pinnable() {
|
||||||
const { channel } = this;
|
const { channel } = this;
|
||||||
return Boolean(
|
|
||||||
!this.system &&
|
if (this.system) return false;
|
||||||
(!this.guild ||
|
if (!this.guild) return true;
|
||||||
(channel?.viewable &&
|
if (!channel?.viewable) return false;
|
||||||
channel?.permissionsFor(this.client.user)?.has(PermissionFlagsBits.ManageMessages, false))),
|
|
||||||
|
const permissions = channel?.permissionsFor(this.client.user);
|
||||||
|
if (!permissions) return false;
|
||||||
|
|
||||||
|
return (
|
||||||
|
permissions.has([PermissionFlagsBits.ReadMessageHistory, PermissionFlagsBits.PinMessages]) ||
|
||||||
|
permissions.has([PermissionFlagsBits.ReadMessageHistory, PermissionFlagsBits.ManageMessages])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user