I'm using the current latest version of Discord.js 12.5.3 and tried several different approaches for different versions.
In the documentation I can see there are two args, first of which is "client" and the second one is simply "data", it's not specified which data it needs so it's a bit weird being the first time building a Discord bot.
I've tried to use the first arg only with this code:
bot.on("message", async (msg) => {
  if (!isCommand(msg) || msg.author.bot) return;
  const guild = new Discord.Guild(bot);
  console.log(guild);
});
Then I get this:
<ref *1> Guild {
  members: GuildMemberManager {
    cacheType: [class Collection extends Collection],
    cache: Collection(0) [Map] {},
    guild: [Circular *1]
  },
  channels: GuildChannelManager {
    cacheType: [class Collection extends Collection],
    cache: Collection(0) [Map] {},
    guild: [Circular *1]
  },
  roles: RoleManager {
    cacheType: [class Collection extends Collection],
    cache: Collection(0) [Map] {},
    guild: [Circular *1]
  },
  presences: PresenceManager {
    cacheType: [class Collection extends Collection],
    cache: Collection(0) [Map] {}
  },
  voiceStates: VoiceStateManager {
    cacheType: [class Collection extends Collection],
    cache: Collection(0) [Map] {},
    guild: [Circular *1]
  },
  deleted: false
}
Then I try console.log(guild.members);
and I get
<ref *1> GuildMemberManager {
  cacheType: [class Collection extends Collection],
  cache: Collection(0) [Map] {},
  guild: <ref *2> Guild {
    members: [Circular *1],
    channels: GuildChannelManager {
      cacheType: [class Collection extends Collection],
      cache: Collection(0) [Map] {},
      guild: [Circular *2]
    },
    roles: RoleManager {
      cacheType: [class Collection extends Collection],
      cache: Collection(0) [Map] {},
      guild: [Circular *2]
    },
    presences: PresenceManager {
      cacheType: [class Collection extends Collection],
      cache: Collection(0) [Map] {}
    },
    voiceStates: VoiceStateManager {
      cacheType: [class Collection extends Collection],
      cache: Collection(0) [Map] {},
      guild: [Circular *2]
    },
    deleted: false
  }
}
in which cache is a Collection(0) [Map] {}
and console.log(guild.members.guild.members);
gives the same output than console.log(guild.members);
All code chunks marked as working are from older versions or not working to me.
I was guessing if I need to login the bot on another place but as long as message reply works... Here's the code for reference:
const Discord = require("discord.js");
const bot = new Discord.Client({ disableMentions: "everyone" });
const dotenv = require("dotenv");
dotenv.config();
bot.login(process.env.token);
// event handlers
bot.once("ready", () => {
  console.log("Ready!");
});
bot.on("message", async (msg) => {
  if (!isCommand(msg) || msg.author.bot) return;
  /* 
  // get guild online member usernames
  
  const guild = new Discord.Guild(bot);
  console.log(guild.members);
   */
  msg.reply(handle(msg.content, msg.author.username));
});
Can you put me in the right direction about how to reach this? Thanks