2 回答

TA貢獻1829條經驗 獲得超6個贊
我不知道您使用的是哪個版本,但setChannel('The Grind 3')
您應該setChannel('channel id')
使用哪個版本setting>Appearance>turn on Developer Mode
,然后右鍵單擊指定的頻道并復制 id 并粘貼它而不是“The Grind 3”,這應該可以:)

TA貢獻1820條經驗 獲得超9個贊
這很容易做到。
首先,您需要找到您要使用的頻道。
const VCchannel = message.guild.channels.cache.find(channel => channel.name === 'The Grind 3');
現在您可以設置將成員發送到該語音通道。注意:我們在這里捕獲錯誤,以便在出現問題時可以進行處理。
message.member.voice.setChannel(VCchannel).catch(err => console.log(err));
請記住,只有當使用此命令的成員已經在語音頻道中時,這才有效,因為機器人無法強制某人進入語音頻道。
注意:您可能需要考慮檢查該成員是否是機器人,如果是則返回。這樣做的優點是您不需要將整個代碼放入語句中if。
if (message.author.bot) return;
您的整個onMessage活動應該看起來有點像這樣。
client.on('message', message => {
if (message.author.bot) return;
if (message.content == 'password') {
message.delete();
const VCchannel = message.guild.channels.cache.find(channel => channel.name === 'The Grind 3');
message.member.voice.setChannel(VCchannel).catch(err => console.log(err));
}
})
添加回答
舉報