get channel permission for user

is it possible to check if user has a certain permission in channel for example
let ow = message.channel.permissionoverwrites.get(userID);
if (ow) {
if (ow.Speak === false) {
do the command
}
}
let ow = message.channel.permissionoverwrites.get(userID);
if (ow) {
if (ow.Speak === false) {
do the command
}
}
9 Replies
d.js toolkit
d.js toolkit9mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by staff
d.js docs
d.js docs9mo ago
class PermissionOverwriteManager (extends CachedManager) Manages API methods for guild channel permission overwrites and stores their cache.
Forhand.
Forhand.9mo ago
@wolvinny🌈 sorry I didn't understand that clearly
treble/luna
treble/luna9mo ago
<TextChannel>.permissionOverwrites returns a PermissionOverwriteManager
Forhand.
Forhand.9mo ago
after caching it deny: PermissionsBitField { bitfield: 2097152n } that's how I got it, how to check if the disabled permission was Speak or something else
d.js docs
d.js docs9mo ago
method PermissionsBitField#toArray() Gets an Array of bitfield names based on the permissions available.
Forhand.
Forhand.9mo ago
@wolvinny🌈 I could get the bitfild through <TextChannel>.permissionOverwrites.cache.get(id).deny.bitfield but after this I'm confused how to turn it to array
treble/luna
treble/luna9mo ago
.deny.toArray()
Forhand.
Forhand.9mo ago
Thanks a lot ❤️