user13224308
user13224308

Reputation:

Is there a way to find a member by id in Discord JDA?

I need my bot to see if a user has a certain id to ban him if him is in the global blacklist, something like:

if(member id == 4950385304) {
ban him
}

Sorry if i wasn't clear and thanks in advance.

Upvotes: 0

Views: 1738

Answers (1)

Minn
Minn

Reputation: 6134

If you already have the member instance, you can simply check the id:

if (member.getIdLong() == 1234567891234567L) {
    member.ban(0).queue();
}

Alternatively, you can simply ban members by id:

guild.ban(1234567891234567L, 0).queue();

Upvotes: 2

Related Questions