How can I check if a user id has permission to send messages to a channel?

Hello, I am trying to check if a user has permission to send messages to a channel like this:
const canSpeak = channel.permissionsFor(senderId)?.has('SendMessages')

But this seems to always return true even when it shouldn't. Are there some intents I need to enable, and is this the wrong way to do this? I just need a basic way to tell if they should be able to chat in the channel. Could I just check if they are a member of the channel? I haven't used Discord all that much but I feel like it is possible to be a member of a channel yet still not have permission to chat in it.

I would also like to know how to do this for reading messages/reading message history. Thank you!
Was this page helpful?