Home > Mobile >  discord.js v14 trying to do that my bot status will be the amount of servers that the bot is in them
discord.js v14 trying to do that my bot status will be the amount of servers that the bot is in them

Time:09-23

I'm trying to do that my bot status will be the number of servers that he is in them.

I tried:

client.on("ready", () => {
    // let guildsCount = client.guilds.size
  client.user.setPresence({
    activities: [
      { name: `${client.guilds.size} Servers!`, type: ActivityType.Watching },
    ],
    status: "online",
  });
});

and it's saying watching undefined servers!

I also tried:

let guildsCount = client.guilds.cache.map(guild => guild.);

but I don't know what to do after the "." to get the number of the guilds I also tried:

let guildsCount = client.guilds.cache.get()

but it didn't work either saying watching undefined

CodePudding user response:

client.guilds.size will return to you as undefined. You should use client.guilds.cache.size

  • Related