mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
fix(Message): update pinnable to use PinMessages (#11202)
* fix(Message): update `pinnable` to use `PinMessages` * refactor: use bitwise OR Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> * fix: check if in voice based channel for pinnable * Update packages/discord.js/src/structures/Message.js * Update packages/discord.js/src/structures/Message.js Co-authored-by: Almeida <github@almeidx.dev> * Update packages/discord.js/src/structures/Message.js Co-authored-by: Almeida <github@almeidx.dev> --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: Almeida <github@almeidx.dev>
This commit is contained in:
@@ -799,12 +799,15 @@ 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 || channel.isVoiceBased() || !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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user