Check if user is banned or not

Tags: ,



I cant seem to figure out how to check if a user is already banned if tried this event.getGuild().retrieveBan(event.getUser() but you cant use an if statement with it

Answer

You should use the failure and success callbacks:

guild.retrieveBan(user).queue(
  (success) -> {
    // the user is banned
  }, 
  (failure) -> {
    // the user is not banned
  }
);


Source: stackoverflow