我最近安装了 Discord.js 13.1.0,但我的音乐命令坏了,因为显然channel.join();它不是一个函数,尽管我已经在 12.5.3 上使用它几个月了……
有人知道解决这个问题吗?
我的加入命令的某些部分:
const { channel } = message.member.voice;
const voiceChannel = message.member.voice.channel;
await channel.join();
Run Code Online (Sandbox Code Playgroud)
它会导致错误。
即使我处于异步函数中,我仍然收到此错误......
import { dirname, join } from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export async function importer(client) {
const dir = join(__dirname, "../../commands/")
const commandCategories = readdirSync(dir)
for (let cat of commandCategories) {
const commandFiles = readdirSync(join(dir, cat)).filter(files => files.endsWith(".js"));
for (const file of commandFiles) {
const command = await import(join(dir, cat, file));
client.commands.set(command.default.name, command.default);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我有什么遗漏的吗?import我绝对需要in中的 wait 部分const command。它导入一些命令,然后在控制台输出上删除标题中提到的错误。
谢谢。