mirror of https://github.com/sgoudham/Enso-Bot.git
Add SlashCommandListener.java
parent
0ddb21eec0
commit
2bb8ede97b
@ -0,0 +1,24 @@
|
||||
package me.goudham.listener;
|
||||
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Singleton;
|
||||
import me.goudham.command.CommandManager;
|
||||
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@Singleton
|
||||
public class SlashCommandListener extends ListenerAdapter {
|
||||
private final CommandManager commandManager;
|
||||
|
||||
@Inject
|
||||
public SlashCommandListener(CommandManager commandManager) {
|
||||
this.commandManager = commandManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlashCommand(@NotNull SlashCommandEvent event) {
|
||||
if (event.getGuild() == null) return;
|
||||
commandManager.handleSlashCommandEvent(event);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue