簡體   English   中英

如何修復 TypeError:無法讀取 null 的屬性“名稱”

[英]How can i fix TypeError: Cannot read property 'name' of null

module.exports = {
name: 'binfo',
description: 'Bot info',
caategory: 'info',

execute(message, args){
    const Discord = require('discord.js')
    const bot = new Discord.Client()
     const binfo = new Discord.MessageEmbed()
.setTitle("Bot Information")
.addField("Bot Name :", bot.user.name)
.addField("Version : ", version)
.addField("Created By :", '')
.addField('Servers with this bot :', bot.guilds.size)
.addImage('')
.addField("Created At : ", bot.user.createdAt)
.addField("Commands :", "For More Commands Check Text Channel commands-guide🔣")
.setTimestamp()
.setColor("#3d5eff")
.setThumbnail(bot.user.displayAvatarURL)




}
}

我知道由於某種原因它無法讀取名稱。 是用戶名還是別的什么? 如果你知道讓我知道謝謝。

沒有這樣的事情

<client>.user.name

正確的是:

<client>.user.username

閱讀

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM