![](/img/trans.png)
[英]discord.js Error TypeError: Cannot read property 'voiceChannel' of undefined
[英]TypeError: Cannot read property 'Collection' of undefined discord.js
我無法運行腳本,因為我收到錯誤:
TypeError:無法讀取未定義的屬性“集合”
const fs = require('fs'); const { Client, Util, MessageEmbed, discord} = require("discord.js"); const prefix = (process.env.DISCORD_PREFIX); const { Player } = require('discord-player'); const bot = new Client({ disableMentions: "all" }); bot.player = new Player(bot); bot.emotes = require('./config/emojis.json'); bot.filters = require('./config/filter.json'); bot.on('message', message => { bot.commands = new discord.Collection()();; });
嘗試創建另一個像這樣const Discord = require('discord.js')
並將new discord.Collection()
更改為new Discord.Collection()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.