简体   繁体   English

Discord.js v14 权限 | RangeError [BitFieldInvalid]:无效的位域标志或数字:STREAM

[英]Discord.js v14 Permissions | RangeError [BitFieldInvalid]: Invalid bitfield flag or number: STREAM

I using discord.js V14 to check if a voice channel has streaming permissions enabled.我使用 discord.js V14 检查语音通道是否启用了流媒体权限。

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.顺便说一句,此代码与“连接”权限完美配合。

Well, did you try using Stream instead of STREAM ?那么,您是否尝试使用Stream而不是STREAM I can't see anything else if it's working using Connect .如果它正在使用Connect ,我看不到任何其他东西。

In v14, you can't use STREAM or other strings, you should use the enums from PermissionFlagsBits :在 v14 中,您不能使用STREAM或其他字符串,您应该使用PermissionFlagsBits中的枚举:

const { PermissionFlagsBits } = require('discord.js')

// ...

if (voiceChannel.permissionsFor(voiceChannel.guild.id)
  .has(PermissionFlagsBits.Stream)
)

You can view all the available permissions here: PermissionFlagsBits您可以在此处查看所有可用权限: PermissionFlagsBits

Related: Errors with enums in discord.js v14相关: discord.js v14 中的枚举错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM