mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
fix(Message): check if in voice based channel for pinnable (#11215)
* fix(Message): check if in voice based channel for `pinnable` * chore: changes from main --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
@@ -781,17 +781,16 @@ class Message extends Base {
|
|||||||
*/
|
*/
|
||||||
get pinnable() {
|
get pinnable() {
|
||||||
const { channel } = this;
|
const { channel } = this;
|
||||||
|
|
||||||
if (this.system) return false;
|
if (this.system) return false;
|
||||||
if (!this.guild) return true;
|
if (!this.guild) return true;
|
||||||
if (!channel?.viewable) return false;
|
if (!channel || channel.isVoiceBased() || !channel.viewable) return false;
|
||||||
|
|
||||||
const permissions = channel?.permissionsFor(this.client.user);
|
const permissions = channel?.permissionsFor(this.client.user);
|
||||||
if (!permissions) return false;
|
if (!permissions) return false;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
permissions.has([PermissionFlagsBits.ReadMessageHistory, PermissionFlagsBits.PinMessages]) ||
|
permissions.has(PermissionFlagsBits.ReadMessageHistory | PermissionFlagsBits.PinMessages) ||
|
||||||
permissions.has([PermissionFlagsBits.ReadMessageHistory, PermissionFlagsBits.ManageMessages])
|
permissions.has(PermissionFlagsBits.ReadMessageHistory | PermissionFlagsBits.ManageMessages)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user