Home > Back-end >  Check status of user
Check status of user

Time:12-16

How do i check the status of a user in my server? as user.presence.status is depreciated. And I won't use

    let guild = await client.guilds.cache.find(guild => guild.id === "xxx");
    let guildMembers = await guild.members.fetch({ withPresences: true });
    var onlineMembers = await guildMembers.filter(member => !member.user.bot && member.presence?.status != "offline");

Since this just checks who's online but doesn't actually return the status of the specific user I need

CodePudding user response:

You can access it through <GuildMember>.presence.status, provided that the appropriate intents are enabled.

For help on intents you may want to look at the guide.

If you have the ID, you can do:

const member = await guild.members.fetch(ID);
console.log(member.presence.status)
  • Related