I am trying to make my discord bot to print all the servers that it's connected to but when I try to run my code I get this type error:
TypeError: client.guilds.forEach is not a function
const Discord = require("discord.js")
const client = new Discord.Client()
client.on("ready", () => {
console.log("Conectat ca si: " + client.user.tag)
client.user.setActivity("my brother kiko jr", {type: "WATCHING"})
client.guilds.forEach((guild) => {
console.log(guild.name)
})
})
client.login("xyz")