mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +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() {
|
||||
const { channel } = this;
|
||||
|
||||
if (this.system) return false;
|
||||
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);
|
||||
if (!permissions) return false;
|
||||
|
||||
return (
|
||||
permissions.has([PermissionFlagsBits.ReadMessageHistory, PermissionFlagsBits.PinMessages]) ||
|
||||
permissions.has([PermissionFlagsBits.ReadMessageHistory, PermissionFlagsBits.ManageMessages])
|
||||
permissions.has(PermissionFlagsBits.ReadMessageHistory | PermissionFlagsBits.PinMessages) ||
|
||||
permissions.has(PermissionFlagsBits.ReadMessageHistory | PermissionFlagsBits.ManageMessages)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user