-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommandManager.java
32 lines (25 loc) · 1.06 KB
/
CommandManager.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.googool.github.paperjda.Commands;
import com.googool.github.paperjda.Commands.Discord.Ping;
import net.dv8tion.jda.api.events.session.ReadyEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.dv8tion.jda.api.interactions.commands.build.CommandData;
import net.dv8tion.jda.api.interactions.commands.build.Commands;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
/**
* Add new EventListeners inside the CommandManager to prevent clocking up the PaperJD.
*/
public class CommandManager extends ListenerAdapter {
@Override
public void onReady(@NotNull ReadyEvent event) {
// Add ListenerAdapters here to register.
event.getJDA().addEventListener(
new Ping()
);
// Register and give your commands a name and description.
List<CommandData> commandData = new ArrayList<>();
commandData.add(Commands.slash("ping", "Pong! 🏓"));
event.getJDA().updateCommands().addCommands(commandData).queue();
}
}