Discord 机器人在尝试建立语音连接时卡在 "Signalling " 状态。 discordjs v13
Discord bot stuck in "Signalling " state when trying to establish a voice connection. discordjs v13
所以我一直在研究 discord 音乐机器人,但每当我尝试让机器人加入语音频道时,什么都没有发生,我也没有错误。我用 console.log(getVoiceConnections())
试图找出问题所在,它说 status: "signalling"
。我认为它卡在信号中,但我不知道如何修复它。这些都是我的意图:
({ intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_VOICE_STATES,
Intents.FLAGS.GUILD_PRESENCES
] });
这是我用来加入的代码:
const {
joinVoiceChannel,
createAudioPlayer,
createAudioResource,
getVoiceConnections
} = require('@discordjs/voice')
module.exports = {
name: 'join',
description: "attempts to join a voicechannel",
execute(message, args) {
const connection = joinVoiceChannel({
channelId: message.member.voice.channel.id,
guildId: 828953538952298517,
adapterCreator: message.channel.guild.voiceAdapterCreator,
});
let audioPlayer = createAudioPlayer();
connection.subscribe(audioPlayer);
console.log(getVoiceConnections())
const resource = createAudioResource('')
audioPlayer.play(resource)
message.reply('Joining!');
}
}
这是 official documentation 如果有人可以在那里找到我的解决方案
joinVoiceChannel()
中的 guildId
字段不应该是 integer
,而是 String
。由于您将其设置为 integer
,它可能不知道要连接到哪个公会,只是发出要查找频道的信号。
所以我一直在研究 discord 音乐机器人,但每当我尝试让机器人加入语音频道时,什么都没有发生,我也没有错误。我用 console.log(getVoiceConnections())
试图找出问题所在,它说 status: "signalling"
。我认为它卡在信号中,但我不知道如何修复它。这些都是我的意图:
({ intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_VOICE_STATES,
Intents.FLAGS.GUILD_PRESENCES
] });
这是我用来加入的代码:
const {
joinVoiceChannel,
createAudioPlayer,
createAudioResource,
getVoiceConnections
} = require('@discordjs/voice')
module.exports = {
name: 'join',
description: "attempts to join a voicechannel",
execute(message, args) {
const connection = joinVoiceChannel({
channelId: message.member.voice.channel.id,
guildId: 828953538952298517,
adapterCreator: message.channel.guild.voiceAdapterCreator,
});
let audioPlayer = createAudioPlayer();
connection.subscribe(audioPlayer);
console.log(getVoiceConnections())
const resource = createAudioResource('')
audioPlayer.play(resource)
message.reply('Joining!');
}
}
这是 official documentation 如果有人可以在那里找到我的解决方案
joinVoiceChannel()
中的 guildId
字段不应该是 integer
,而是 String
。由于您将其设置为 integer
,它可能不知道要连接到哪个公会,只是发出要查找频道的信号。