Home > OS >  UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'guildes' of undefined D
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'guildes' of undefined D

Time:10-14

can you please help me i just need to change the bot status every 10 secs here's the code

const mySecret = process.env['token']

const Discord = require('discord.js')
const client = new Discord.Client();
client.on('ready', () => {
 console.log(`Discord.js: Ready on: ${client.user.tag} ✅`)
 
 const activitives = [
   `${this.client.guildes.cache.size} servers!`,
   `${this.client.channels.cache.size} channels!`,
   `${this.client.guildes.cache.reduce((a,b) => a   b.memberCount, 0)} users!`,
 ];
 
  let i = 0

  setInterval(() => this.client.user.serActivity(`?bhelp |${activities[i   % activities.length]}`, { type : 'LISTENING'}), 20);
})

CodePudding user response:

If I'm not mistaken... Try removing "this."

  • Related