Creating a command - Alhxe/Discord-Integration GitHub Wiki

Creating a command

You just have to create a class that implements DiscordCommand. This class will generate the following for you when implementing the methods:

public class ExampleCommand implements DiscordCommand {

   @Override
   public void execute(String message, MessageReceivedEvent event) {
      // My command code
      // message is the message removing the alias
      // event is the event provided by JDA
   }

   @Override
   public String getAlias() {
      // This is the alias with which users will call the command
      return "mycommandalias";
   }
}

Once created you would only have to add it to the dicore api with api.registerDiscordCommand(new ExampleCommand());