Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 1.13 KB

README.md

File metadata and controls

43 lines (33 loc) · 1.13 KB

KSoftBans4JDA

A simple way of adding global ban functinality to any JDA bot!

How to use:

  1. Create a BanListener object:
import net.benjaminurquhart.ksoftbans4jda.*;
...
BanListener banListener = new BanListener("KSoft Token", true);
  1. Register the listener:
jda.addEventListener(banListener);

That's it!

Global Ban Handler

Global Ban Hander can be used to detect when the ban listener has banned a member. You can create one by implementing the GlobalBanHandler interface.

public BanHandler implements GlobalBanHandler{
  
  @Override
  public void onGlobalBanEvent(GlobalBanEvent event){
      System.out.println("User " + event.getBanInfo().getEffectiveName() + " was banned in " + event.getGuild().getName());
  }
  @Override
  public void onBannedUserJoin(BannedUserJoinEvent event){
      System.out.println("Globally banned user " + event.getBanInfo() + " joined the guild " + event.getGuild().getName());
  }
}

Next, register this listener:

banListener.addHandler(new BanHandler());

Both GlobalBanEvent and BannedUserJoinEvent have accessors for the JDA GuildMemberJoinEvent fields