Discord.js 13 channel.join 不是函数 [英] Discord.js 13 channel.join is not a function

查看:12
本文介绍了Discord.js 13 channel.join 不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近安装了 Discord.js 13.1.0 并且我的音乐命令中断了,因为显然 channel.join(); 不是一个函数,尽管我在 12.5 上已经使用了几个月.3...

I recently installed Discord.js 13.1.0 and my music commands broke because, apparently, channel.join(); is not a function, although I have been using it for months on 12.5.3...

有人知道解决办法吗?

我的加入命令的某些部分:

Some parts of my join command:

const { channel } = message.member.voice;
const voiceChannel = message.member.voice.channel;

await channel.join();

这会导致错误.

推荐答案

Discord.js 不再支持语音.您需要使用他们制作的其他软件包(@discordjs/voice).您可以从那里导入 joinVoiceChannel.

Discord.js no longer supports voice. You need to use the other package they made (@discordjs/voice). You can import joinVoiceChannel from there.

//discord.js and client declaration
const { joinVoiceChannel } = require('@discordjs/voice');
client.on('messageCreate', message => {
    if(message.content === '!join') {
        joinVoiceChannel({
            channelId: message.member.voice.channel.id,
            guildId: message.guild.id,
            adapterCreator: message.guild.voiceAdapterCreator
        })
    }
})

这篇关于Discord.js 13 channel.join 不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆