Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda