简体   繁体   中英

Discord.js TypeError: Cannot read property 'setActivity' of null

How can I fix this? I'm getting an error like TypeError: Cannot read property 'setActivity' of null .

client.on('ready', message  => {
  client.user.setActivity("21"+`${client.guilds.size} servers have members`+" "+"5"+`${client.users.size}`+` | !help `, { type: 'WATCHING' })
  console.log("21"+`${client.guilds.size} servers have members `+" "+"5"+`${client.users.size}`) 
});

Make sure that the Client is logged in. That is the only way I could think those properties would be null.

I found how to fix i'm use new TOKEN(New bot)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM