Skip to content

Commit

Permalink
fix(add new CommandHandler)
Browse files Browse the repository at this point in the history
  • Loading branch information
jalpp authored May 10, 2024
1 parent 64178bd commit cb55ebc
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/main/java/Discord/MainHandler/CommandHandler.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package Discord.MainHandler;

import Discord.HandlerModules.ButtonContextModule;
import Discord.HandlerModules.MessageContextModule;
import Discord.HandlerModules.ModalContextModule;
import Discord.HandlerModules.SlashContextModule;
import Discord.HandlerModules.*;
import chariot.Client;
import com.github.bhlangonijr.chesslib.Board;
import lombok.SneakyThrows;
import net.dv8tion.jda.api.events.interaction.ModalInteractionEvent;
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
import net.dv8tion.jda.api.events.interaction.command.MessageContextInteractionEvent;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent;
Expand All @@ -24,44 +22,51 @@ public class CommandHandler extends ListenerAdapter {
private final Board blackboard = new Board();
private final MessageContextModule msgContext = new MessageContextModule();
private final SlashContextModule slashContext = new SlashContextModule();

private final ModalContextModule modalContext = new ModalContextModule();

private final ButtonContextModule buttonContext = new ButtonContextModule();

private final AutoCompleteContextModule autoContext = new AutoCompleteContextModule();

public CommandHandler() {

}

@Override
public void onMessageContextInteraction(@NotNull MessageContextInteractionEvent event) {
msgContext.handleLogic(event, null, null, null, client, null, null, null, null, null);
msgContext.handleLogic(event, null, null, null,null ,client, null, null, null, null, null);
}


@SneakyThrows
public void onSlashCommandInteraction(@NotNull SlashCommandInteractionEvent event) {
slashContext.handleLogic(null, event, null, null, client, board, blackboard, spam, dailySpam, watchLimit);
slashContext.handleLogic(null, event, null, null, null, client, board, blackboard, spam, dailySpam, watchLimit);
}

@Override
public void onModalInteraction(@NotNull ModalInteractionEvent event) {

modalContext.handleLogic(null, null, null, event, client, null, null, null, null, null);
modalContext.handleLogic(null, null, null, event, null ,client, null, null, null, null, null);

}


@Override
public void onButtonInteraction(@NotNull ButtonInteractionEvent event) {

buttonContext.handleLogic(null, null, event, null, client, board, blackboard, null, null, null);
buttonContext.handleLogic(null, null, event, null, null ,client, board, blackboard, null, null, null);

}

@Override
public void onCommandAutoCompleteInteraction(@NotNull CommandAutoCompleteInteractionEvent event) {

}
autoContext.handleLogic(null, null, null, null, event, client, null, null, null, null, null);

}




}



Expand Down

0 comments on commit cb55ebc

Please sign in to comment.