Search in sources :

Example 1 with Command

use of de.c0debase.bot.commands.Command in project c0debaseBot by Biospheere.

the class MessageReactionListener method onGenericPrivateMessageReaction.

@Override
public void onGenericPrivateMessageReaction(GenericPrivateMessageReactionEvent event) {
    super.onGenericPrivateMessageReaction(event);
    if (event.getUser().isBot()) {
        return;
    }
    event.getChannel().getMessageById(event.getMessageId()).queue((Message success) -> {
        final String emote = getReaction(event.getReactionEmote());
        if (emote == null) {
            return;
        }
        if (!success.getEmbeds().isEmpty() && success.getAuthor().isBot()) {
            EmbedBuilder embedBuilder = new EmbedBuilder();
            embedBuilder.setColor(Color.GREEN);
            if (emote.equalsIgnoreCase("wastebasket")) {
                success.delete().queue();
                return;
            }
            for (Categorie categorie : Categorie.values()) {
                if (categorie.getEmote().equalsIgnoreCase(emote)) {
                    embedBuilder.setTitle(":question: " + categorie.getName() + " Commands Help");
                    for (Command command : CodebaseBot.getInstance().getCommandManager().getAvailableCommands()) {
                        if (command.getCategorie() == categorie) {
                            embedBuilder.appendDescription("**!" + command.getCommand() + "**\n" + command.getDescription() + "\n\n");
                        }
                    }
                    success.editMessage(embedBuilder.build()).queue();
                    break;
                }
            }
        }
    });
}
Also used : Categorie(de.c0debase.bot.commands.Command.Categorie) EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) Command(de.c0debase.bot.commands.Command)

Example 2 with Command

use of de.c0debase.bot.commands.Command in project c0debaseBot by Biospheere.

the class HelpCommand method execute.

@Override
public void execute(final String[] args, final Message message) {
    final EmbedBuilder embedBuilder = getEmbed(message.getGuild(), message.getAuthor());
    final Collection<Command> commandCollection = bot.getCommandManager().getAvailableCommands();
    if (args.length == 0) {
        embedBuilder.setTitle("Command Übersicht");
        appendCommandOverview(commandCollection, embedBuilder);
    } else {
        addCommandDescription(args[0], commandCollection, embedBuilder);
    }
    message.getTextChannel().sendMessage(embedBuilder.build()).queue();
}
Also used : EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder) Command(de.c0debase.bot.commands.Command)

Aggregations

Command (de.c0debase.bot.commands.Command)2 Categorie (de.c0debase.bot.commands.Command.Categorie)1 EmbedBuilder (net.dv8tion.jda.api.EmbedBuilder)1 EmbedBuilder (net.dv8tion.jda.core.EmbedBuilder)1