Discord.js GUILD_VOICE_STATES

Discord.js GUILD_VOICE_STATES

为了在 Discord 上创建音乐机器人,我必须使用“GUILD_VOICE_STATES”。但是,当我 运行 我的代码时,我返回了这个错误:PlayerError: [PlayerError] client is missing "GUILD_VOICE_STATES" intent (at [all sorts of places]).

如何在 repl.it 上解决此问题?

如果您想查看我的代码:https://replit.com/@TylerLanier/Comusity-Bot#index.js

  intents: [
    "GUILDS"
    *"GUILD_VOICE_STATES"```*

您想像这样设置意图...

const Discord = require('discord.js')


const client = new Discord.Client({
  intents: [
    Discord.Intents.FLAGS.GUILDS,
    Discord.Intents.FLAGS.GUILD_VOICE_STATES
  ]
})

More on Intents Here