Jda: Online Users

Created on 13 May 2017  路  6Comments  路  Source: DV8FromTheWorld/JDA

Is there a way to get the online users from a server?

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.

All 6 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

napstr picture napstr  路  3Comments

hitsu420 picture hitsu420  路  6Comments

Drischdaan picture Drischdaan  路  4Comments

stefaandevylder picture stefaandevylder  路  5Comments

AutismSpeaks picture AutismSpeaks  路  4Comments