Skip to content

Prebuilt global ban listener for JDA, based on the KSoft Global Bans API

License

Notifications You must be signed in to change notification settings

KSoft-Si/KSoftBans4JDA

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

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

About

Prebuilt global ban listener for JDA, based on the KSoft Global Bans API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%