This repository was archived by the owner on Feb 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Events
Devin Fritz edited this page Jul 23, 2020
·
4 revisions
Events
To implemented EventAPI is super easy to use. To create an event you only have to implement the Listener class.
de.staticred.discordbot.api.Listener
Every listener class needs atleast 1 method to work. The method then needs to have the @BotEvent annotation.
de.staticred.discordbot.api.BotEvent
The name of the method doesn't matter. In the parameters you then set which event you want. Here is an little example of event.
public class TestUserVerifiedEvent implements Listener {
@BotEvent
public void onUserVerified(UserVerifiedEvent event) {
//do stuff
}
}
To register an event you need to use the VerifyAPI and the registerEvent method.
VerifyAPI.getInstance().registerEvent(new TestUserVerifiedEvent());
All events are cancelable.
At the moment the plugin has 4 events.
- UserClickedMessageEvent -> This is fired when a player clicks on accept or decline.
- UserUnverifiedEvent -> This is fired when a player unlinks himself
- UserUpdateRolesEvent -> (Not cancelable) This event is fired when a player gets new roles
- UserVerifedEvent -> This is fired when a players gets verified