Is there a way to get the online users from a server?
Sure, as long as you/the bot(s)/whatever is a member of the guild, of course. There are a few ways you can do it. Here's a way to start out within a guild - event.getGuild().getMembers().stream() - finish it off with a lambda expression. You can use something like getOnlineStatus().toString().equals("ONLINE") as a crude way of checking each member. Anyway, these were just a few quick pointers.
Oke, thanks :)
@shikhir-arora Never compare Enums using their toString() methods, it defeats their entire purpose. You can compare Enums safely with the == operator, e.g. getOnlineStatus() == OnlineStatus.ONLINE.
@Almighty-Alpaca 馃う
yeah... that was something I did and had saved from months ago to quickly check - but yeah, thanks for pointing that out. 馃憤
Thanks for help 馃槃
As it sounds like this issue is resolved I'm closing it now
Most helpful comment
@shikhir-arora Never compare Enums using their
toString()methods, it defeats their entire purpose. You can compare Enums safely with the==operator, e.g.getOnlineStatus() == OnlineStatus.ONLINE.