Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'guildes' of undefined Discord.js

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);
})
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Okay so firstly, its guild not guildes also, you have to remove the .this function Lemme try and redefine the code so you achieve what you want


const Discord = require('discord.js')
const client = new Discord.Client();
client.on('ready', () => {
 console.log(`Discord.js: Ready on: ${client.user.tag} ✅`)
 
 const activities= [
   `${client.guilds.cache.size} servers!`,
   `${client.channels.cache.size} channels!`,
   `${client.users.cache.size} users!`,
 ];
setInterval(() => {
        const index = Math.floor(Math.random() * (activities.length - 1) + 1);
        client.user.setActivity(`?bhelp | ${activities[index]});
    }, 10000);

This should pretty much be it your logic and code was almost perfect, just a few typos and misused functions that I fixed.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!