Added evidence command
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
package com.alttd.commandManager;
|
||||
|
||||
import com.alttd.commandManager.commands.AddCommand.CommandManage;
|
||||
import com.alttd.commandManager.commands.CommandHelp;
|
||||
import com.alttd.commandManager.commands.CommandSetOutputChannel;
|
||||
import com.alttd.commandManager.commands.CommandSuggestion;
|
||||
import com.alttd.commandManager.commands.CommandUpdateCommands;
|
||||
import com.alttd.commandManager.commands.*;
|
||||
import com.alttd.commandManager.commands.PollCommand.CommandPoll;
|
||||
import com.alttd.database.Database;
|
||||
import com.alttd.modalManager.ModalManager;
|
||||
@@ -42,7 +39,8 @@ public class CommandManager extends ListenerAdapter {
|
||||
new CommandPoll(jda, this),
|
||||
new CommandSuggestion(jda, modalManager, this),
|
||||
new CommandSetOutputChannel(jda, this),
|
||||
new CommandUpdateCommands(jda, this));
|
||||
new CommandUpdateCommands(jda, this),
|
||||
new CommandEvidence(jda, modalManager, this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,32 @@
|
||||
package com.alttd.commandManager.commands;
|
||||
|
||||
import com.alttd.commandManager.CommandManager;
|
||||
import com.alttd.commandManager.DiscordCommand;
|
||||
import com.alttd.config.MessagesConfig;
|
||||
import com.alttd.modalManager.ModalManager;
|
||||
import com.alttd.util.Util;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
|
||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||
import net.dv8tion.jda.api.interactions.commands.build.CommandData;
|
||||
import net.dv8tion.jda.api.interactions.commands.build.Commands;
|
||||
import net.dv8tion.jda.api.interactions.components.Modal;
|
||||
import net.dv8tion.jda.api.requests.RestAction;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class CommandEvidence extends DiscordCommand {
|
||||
|
||||
private final CommandData commandData;
|
||||
private final ModalManager modalManager;
|
||||
|
||||
public CommandEvidence(JDA jda, ModalManager modalManager, CommandManager commandManager) {
|
||||
this.modalManager = modalManager;
|
||||
|
||||
commandData = Commands.slash(getName(), "Open suggestion form.");
|
||||
Util.registerCommand(commandManager, jda, commandData, getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "evidence";
|
||||
@@ -13,21 +34,29 @@ public class CommandEvidence extends DiscordCommand {
|
||||
|
||||
@Override
|
||||
public void execute(SlashCommandInteractionEvent event) {
|
||||
|
||||
Modal modal = modalManager.getModalFor("evidence");
|
||||
if (modal == null) {
|
||||
event.replyEmbeds(Util.genericErrorEmbed("Error",
|
||||
"Unable to find evidence modal."))
|
||||
.setEphemeral(true).queue(RestAction.getDefaultSuccess(), Util::handleFailure);
|
||||
return;
|
||||
}
|
||||
event.replyModal(modal).queue(RestAction.getDefaultSuccess(), Util::handleFailure);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void suggest(CommandAutoCompleteInteractionEvent event) {
|
||||
|
||||
event.replyChoices(Collections.emptyList())
|
||||
.queue(RestAction.getDefaultSuccess(), Util::handleFailure);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpMessage() {
|
||||
return null;
|
||||
return MessagesConfig.HELP_SUGGESTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandData getCommandData() {
|
||||
return null;
|
||||
return commandData;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user