discord - Discord.js 13 channel.join 不是函数
问题描述
我最近安装了 Discord.js 13.1.0 并且我的音乐命令坏了,因为显然channel.join();
它不是一个功能,尽管我在 12.5.3 上已经使用了几个月......
有人知道解决这个问题吗?
我的 join 命令的某些部分:
const { channel } = message.member.voice;
const voiceChannel = message.member.voice.channel;
await channel.join();
它导致错误。
解决方案
Discord.js 不再支持语音。您需要使用他们制作的其他软件包(@discordjs/voice)。joinVoiceChannel
您可以从那里导入。
//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
})
}
})
推荐阅读
- java - EOSIO-java Maven 依赖问题
- javascript - 如何循环数组并仅获取特定索引的值
- c# - XAML UI 使用 Observable 集合 MVVM 很慢
- php - 我的 for 循环不是循环所有数据吗?
- c - 如何在没有 sscanf 的情况下解析 URL 字符串
- qt - 如何在 Qt 中设置随 HiDPI 缩放的固定图标大小
- docker - 了解 docker 容器 cpu 的使用
- python - TypeError:字符串索引必须是整数 - 清理我的文本
- bazel - 将 maven-shade-plugin 规则迁移到 bazel
- caching - stale-while-revalidate 缓存策略是什么意思?