|
1 | | -package net.javadiscord.javabot.systems.staff_commands; |
| 1 | +package net.javadiscord.javabot.systems.staff_commands.role_emoji; |
2 | 2 |
|
3 | 3 | import org.jetbrains.annotations.NotNull; |
4 | 4 |
|
5 | | -import com.dynxsty.dih4jda.interactions.commands.SlashCommand; |
| 5 | +import com.dynxsty.dih4jda.interactions.commands.SlashCommand.Subcommand; |
6 | 6 |
|
7 | | -import net.dv8tion.jda.api.Permission; |
8 | 7 | import net.dv8tion.jda.api.entities.Message.Attachment; |
9 | 8 | import net.dv8tion.jda.api.entities.Role; |
10 | 9 | import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; |
11 | | -import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions; |
12 | 10 | import net.dv8tion.jda.api.interactions.commands.OptionMapping; |
13 | 11 | import net.dv8tion.jda.api.interactions.commands.OptionType; |
14 | | -import net.dv8tion.jda.api.interactions.commands.build.Commands; |
15 | | -import net.dv8tion.jda.api.interactions.commands.build.SlashCommandData; |
| 12 | +import net.dv8tion.jda.api.interactions.commands.build.SubcommandData; |
16 | 13 | import net.javadiscord.javabot.data.config.BotConfig; |
17 | 14 | import net.javadiscord.javabot.util.Checks; |
18 | 15 | import net.javadiscord.javabot.util.Responses; |
19 | 16 |
|
20 | 17 | /** |
21 | | - * This class represents the /add-role-emoji command. |
22 | | - * This command allows adding emojis which are usable only be members with certain roles. |
| 18 | + * This class represents the /emoji-admin add subcommand. |
| 19 | + * This subcommand allows adding emojis which are usable only be members with certain roles. |
23 | 20 | */ |
24 | | -public class RoleEmojiCommand extends SlashCommand{ |
| 21 | +public class AddRoleEmojiSubcommand extends Subcommand{ |
25 | 22 |
|
26 | 23 | private final BotConfig botConfig; |
27 | 24 |
|
28 | 25 | /** |
29 | | - * The constructor of this class, which sets the corresponding {@link net.dv8tion.jda.api.interactions.commands.build.SlashCommandData}. |
| 26 | + * The constructor of this class, which sets the corresponding {@link SubcommandData}s. |
30 | 27 | * @param botConfig The main configuration of the bot |
31 | 28 | */ |
32 | | - public RoleEmojiCommand(BotConfig botConfig) { |
| 29 | + public AddRoleEmojiSubcommand(BotConfig botConfig) { |
33 | 30 | this.botConfig=botConfig; |
34 | | - SlashCommandData slashCommandData = Commands.slash("add-role-emoji", "Adds an emoji only usable only with certain roles") |
| 31 | + SubcommandData subCommandData = new SubcommandData("add", "Adds an emoji only usable only with certain roles") |
35 | 32 | .addOption(OptionType.STRING, "name", "The name of the emoji", true) |
36 | | - .addOption(OptionType.ATTACHMENT, "emoji", "the emoji", true) |
37 | | - .setDefaultPermissions(DefaultMemberPermissions.enabledFor(Permission.ADMINISTRATOR)) |
38 | | - .setGuildOnly(true); |
| 33 | + .addOption(OptionType.ATTACHMENT, "emoji", "the emoji", true); |
39 | 34 | for (int i = 1; i <= 10; i++) { |
40 | | - slashCommandData.addOption(OptionType.ROLE, "role-"+i, "A role allowed to use the emoji", i==1); |
| 35 | + subCommandData.addOption(OptionType.ROLE, "role-"+i, "A role allowed to use the emoji", i==1); |
41 | 36 | } |
42 | | - setSlashCommandData(slashCommandData); |
| 37 | + setSubcommandData(subCommandData ); |
43 | 38 | requireUsers(botConfig.getSystems().getAdminConfig().getAdminUsers()); |
44 | 39 | } |
45 | 40 |
|
|
0 commit comments