package wtf.beatrice.hidekobot.commands.message; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import wtf.beatrice.hidekobot.Cache; import wtf.beatrice.hidekobot.commands.base.BotInfo; import wtf.beatrice.hidekobot.objects.commands.CommandCategory; import wtf.beatrice.hidekobot.objects.commands.MessageCommand; import java.util.Arrays; import java.util.LinkedList; import java.util.List; public class BotInfoCommand implements MessageCommand { @Override public LinkedList getCommandLabels() { return new LinkedList<>(Arrays.asList("botinfo", "info")); } @Nullable @Override public List getPermissions() { return null; // anyone can use it } @Override public boolean passRawArgs() { return false; } @NotNull @Override public String getDescription() { return "Get general info about the bot."; } @Nullable @Override public String getUsage() { return null; } @NotNull @Override public CommandCategory getCategory() { return CommandCategory.TOOLS; } @Override public void runCommand(MessageReceivedEvent event, String label, String[] args) { // get a list of message commands LinkedList messageCommands = Cache.getMessageCommandListener().getRegisteredCommands(); LinkedList commandNames = new LinkedList<>(); for (MessageCommand command : messageCommands) { commandNames.add(command.getCommandLabels().get(0)); } // send the list MessageEmbed embed = BotInfo.generateEmbed(commandNames); event.getMessage().replyEmbeds(embed).queue(); } }