timogames
timogames

Reputation: 19

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)




}
}

I know it cant read the name for some reason. Is it username or even something else? If you know let me know thanks.

Upvotes: 0

Views: 137

Answers (1)

jeepies
jeepies

Reputation: 398

There is no such thing as

<client>.user.name

the correct one is:

<client>.user.username

Please read

Upvotes: 2

Related Questions