You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a3099d2
Browse filesBrowse the repository at this point in the historyBrowse files
Commands are defined in this bot using a `commands.yaml` configuration file. The data in this file is transformed at startup time into an array of `com.javadiscord.javabot.properties.command.CommandConfig` objects using JSON deserialization.
19
+
20
+
These commands are then used by `com.javadiscord.javabot.SlashCommands#registerSlashCommands(Guild)` to register the defined commands as Discord slash commands which become available to users in guilds and private messages with the bot.
21
+
22
+
**Each command MUST define a `handler` property, whose name is the fully-qualified class name of a `SlashCommandHandler`.** When registering commands, the bot will look for such a class, and attempt to create a new instance of it using a no-args constructor. Therefore, make sure that your handler class has a no-args constructor.
23
+
24
+
## Privileges
25
+
To specify that a command should only be allowed to be executed by certain people, you can specify a list of privileges. For example:
26
+
```yaml
27
+
- name: jam-admin
28
+
description: Administrator actions for configuring the Java Jam.
In this example, we define that the `jam-admin` command is first of all, *not enabled by default*, and also we say that anyone from the `jam_admin_rid` role (as found using `new Database().getConfigRole(guild, "roles." + this.id);` from the MongoDB). Additionally, we also say that the user whose id is `235439851263098880` is allowed to use this command.
0 commit comments