This repository was archived by the owner on May 14, 2022. It is now read-only.
forked from Together-Java/TJ-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommands.java
More file actions
65 lines (59 loc) · 2.77 KB
/
Commands.java
File metadata and controls
65 lines (59 loc) · 2.77 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package org.togetherjava.tjbot.commands;
import org.jetbrains.annotations.NotNull;
import org.togetherjava.tjbot.commands.basic.DatabaseCommand;
import org.togetherjava.tjbot.commands.basic.PingCommand;
import org.togetherjava.tjbot.commands.basic.RoleSelectCommand;
import org.togetherjava.tjbot.commands.basic.VcActivityCommand;
import org.togetherjava.tjbot.commands.free.FreeCommand;
import org.togetherjava.tjbot.commands.mathcommands.TeXCommand;
import org.togetherjava.tjbot.commands.moderation.*;
import org.togetherjava.tjbot.commands.tags.TagCommand;
import org.togetherjava.tjbot.commands.tags.TagManageCommand;
import org.togetherjava.tjbot.commands.tags.TagSystem;
import org.togetherjava.tjbot.commands.tags.TagsCommand;
import org.togetherjava.tjbot.db.Database;
import java.util.ArrayList;
import java.util.Collection;
/**
* Utility class that offers all commands that should be registered by the system. New commands have
* to be added here, where {@link org.togetherjava.tjbot.commands.system.CommandSystem} will then
* pick it up from and register it with the system.
* <p>
* To add a new slash command, extend the commands returned by
* {@link #createSlashCommands(Database)}.
*/
public enum Commands {
;
/**
* Creates all slash commands that should be registered with this application.
* <p>
* Calling this method multiple times will result in multiple commands being created, which
* generally should be avoided.
*
* @param database the database of the application, which commands can use to persist data
* @return a collection of all slash commands
*/
public static @NotNull Collection<SlashCommand> createSlashCommands(
@NotNull Database database) {
TagSystem tagSystem = new TagSystem(database);
ModerationActionsStore actionsStore = new ModerationActionsStore(database);
// NOTE The command system can add special system relevant commands also by itself,
// hence this list may not necessarily represent the full list of all commands actually
// available.
Collection<SlashCommand> commands = new ArrayList<>();
commands.add(new PingCommand());
commands.add(new DatabaseCommand(database));
commands.add(new TeXCommand());
commands.add(new TagCommand(tagSystem));
commands.add(new TagManageCommand(tagSystem));
commands.add(new TagsCommand(tagSystem));
commands.add(new VcActivityCommand());
commands.add(new KickCommand(actionsStore));
commands.add(new BanCommand(actionsStore));
commands.add(new UnbanCommand(actionsStore));
commands.add(new FreeCommand());
commands.add(new AuditCommand(actionsStore));
commands.add(new RoleSelectCommand());
return commands;
}
}