0

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.

Zsolt Meszaros
  • 21,961
  • 19
  • 54
  • 57
Tiago Dias
  • 31
  • 3

2 Answers2

0

Well, did you try using Stream instead of STREAM ? I can't see anything else if it's working using Connect.

Dorian349
  • 1,521
  • 1
  • 9
  • 18
0

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

Zsolt Meszaros
  • 21,961
  • 19
  • 54
  • 57