Channel permission check

so i am trying to find if bot have permission to send message in channel or not, i using this code

// Check if the bot has permission to send messages in the music channel
      if (!interaction.guild.members.me.permissionsIn(musicChannel).has(PermissionsBitField.Flags.SendMessages)) {
        return interaction.reply("I don't have permissions to send messages in that channel.").catch(err => {
          client.error(err);
        });
      }


also i have this options enable

props = {
            partials: [
                Partials.Channel, // for text channel
                Partials.GuildMember, // for guild member
                Partials.User, // for discord user
            ],
            intents: [
                GatewayIntentBits.Guilds,
                GatewayIntentBits.GuildInvites,
                GatewayIntentBits.GuildVoiceStates,
                GatewayIntentBits.GuildMessages,
            ],
        }
Was this page helpful?