I using discord.js V14 to check if a voice channel has streaming permissions enabled.
I tried this but it's not working.
if (voiceChannel.permissionsFor(voiceChannel.guild.id).has("STREAM"))
It gives me the following error:
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: STREAM.
btw, this code is working perfectly with the "Connect" permission.
CodePudding user response:
In v14, you can't use STREAM
or other strings, you should use the enums from PermissionFlagsBits
:
const { PermissionFlagsBits } = require('discord.js')
// ...
if (voiceChannel.permissionsFor(voiceChannel.guild.id)
.has(PermissionFlagsBits.Stream)
)
You can view all the available permissions here: PermissionFlagsBits
Related: Errors with enums in discord.js v14
CodePudding user response:
Well, did you try using Stream
instead of STREAM
? I can't see anything else if it's working using Connect
.