Search in sources :

Example 1 with BaseCommand

use of tk.ardentbot.core.executor.BaseCommand in project Ardent by adamint.

the class Help method setupSubcommands.

@Override
public void setupSubcommands() {
    all = new Subcommand("See the traditional help screen", "all", "all") {

        @Override
        public void onCall(Guild guild, MessageChannel channel, User user, Message message, String[] args) throws Exception {
            EmbedBuilder helpEmbed = MessageUtils.getDefaultEmbed(user);
            helpEmbed.setAuthor("Ardent Help", "https://ardentbot.tk/guild", getShard().bot.getAvatarUrl());
            helpEmbed.setThumbnail("https://a.dryicons.com/images/icon_sets/polygon_icons/png/256x256/computer" + ".png");
            StringBuilder description = new StringBuilder();
            description.append("Command Categories\n");
            for (Category category : Category.values()) {
                description.append(" > **" + category.name().toLowerCase() + "**\n");
            }
            description.append("\nType /help [category] to view a specific category\n\nIf you need help, join our support guild: " + "https://ardentbot.tk/guild");
            helpEmbed.setDescription(description.toString());
            sendEmbed(helpEmbed, channel, user);
        }
    };
    subcommands.add(all);
    for (Category category : Category.values()) {
        subcommands.add(new Subcommand("how tf did you see this", Category.getName(category), Category.getName(category)) {

            @Override
            public void onCall(Guild guild, MessageChannel channel, User user, Message message, String[] args) throws Exception {
                EmbedBuilder embedBuilder = MessageUtils.getDefaultEmbed(user);
                embedBuilder.setAuthor("Commands in Category ".replace("{0}", WordUtils.capitalize(category.name().toLowerCase())), "https://ardentbot.tk/guild", getShard().bot.getAvatarUrl());
                ArrayList<BaseCommand> commandsInCategory = Help.this.getCommandsInCategory(category);
                StringBuilder description = new StringBuilder();
                for (BaseCommand baseCommand : commandsInCategory) {
                    description.append(" > **" + baseCommand.getName() + "**: " + baseCommand.getDescription() + "\n");
                }
                embedBuilder.setDescription(description.toString());
                sendEmbed(embedBuilder, channel, user);
            }
        });
    }
}
Also used : User(net.dv8tion.jda.core.entities.User) Category(tk.ardentbot.core.executor.Category) Subcommand(tk.ardentbot.core.executor.Subcommand) Message(net.dv8tion.jda.core.entities.Message) BaseCommand(tk.ardentbot.core.executor.BaseCommand) ArrayList(java.util.ArrayList) Guild(net.dv8tion.jda.core.entities.Guild) EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) MessageChannel(net.dv8tion.jda.core.entities.MessageChannel)

Example 2 with BaseCommand

use of tk.ardentbot.core.executor.BaseCommand in project Ardent by adamint.

the class Help method noArgs.

@Override
public void noArgs(Guild guild, MessageChannel channel, User user, Message message, String[] args) throws Exception {
    EmbedBuilder embedBuilder = MessageUtils.getDefaultEmbed(user);
    embedBuilder.setAuthor("Ardent Help", "https://ardentbot.tk/guild", getShard().bot.getAvatarUrl());
    embedBuilder.setThumbnail("https://a.dryicons.com/images/icon_sets/polygon_icons/png/256x256/computer.png");
    StringBuilder description = new StringBuilder();
    for (Category category : Category.values()) {
        if (category == Category.NSFW) {
            if (!NSFW.csn(user, channel, guild)) {
                continue;
            }
        }
        description.append("**" + WordUtils.capitalize(category.name().toLowerCase()) + "**\n");
        ArrayList<BaseCommand> commandsInCategory = getCommandsInCategory(category);
        for (BaseCommand baseCommand : commandsInCategory) {
            description.append("`" + baseCommand.getName() + "`  ");
        }
        description.append("\n");
    }
    description.append("\nType /help [category] to view a specific category View the full help screen by typing {0}help all".replace("{0}", GuildUtils.getPrefix(guild) + args[0]));
    description.append("\n\nIf you need help, join our support guild @ https://ardentbot.tk/guild");
    embedBuilder.setDescription(description.toString());
    sendEmbed(embedBuilder, channel, user);
}
Also used : EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) Category(tk.ardentbot.core.executor.Category) BaseCommand(tk.ardentbot.core.executor.BaseCommand)

Example 3 with BaseCommand

use of tk.ardentbot.core.executor.BaseCommand in project Ardent by adamint.

the class UsageUtils method orderByUsageDesc.

public static ArrayList<BaseCommand> orderByUsageDesc() {
    ConcurrentLinkedQueue<BaseCommand> unsorted = shard0.factory.getBaseCommands();
    ArrayList<BaseCommand> baseCommands = new ArrayList<>();
    for (BaseCommand c : unsorted) {
        if (!c.getName().equalsIgnoreCase("patreon") && !c.getName().equalsIgnoreCase("translateforardent") && !c.getName().equalsIgnoreCase("tweet") && !c.getName().equalsIgnoreCase("eval") && !c.getName().equalsIgnoreCase("addenglishbase") && !c.getName().equalsIgnoreCase("help") && !c.getName().equalsIgnoreCase("manage") && !c.getName().equalsIgnoreCase("admin")) {
            baseCommands.add(c);
        }
    }
    baseCommands.sort(SORT_BY_USAGE);
    return baseCommands;
}
Also used : BaseCommand(tk.ardentbot.core.executor.BaseCommand)

Aggregations

BaseCommand (tk.ardentbot.core.executor.BaseCommand)3 EmbedBuilder (net.dv8tion.jda.core.EmbedBuilder)2 Category (tk.ardentbot.core.executor.Category)2 ArrayList (java.util.ArrayList)1 Guild (net.dv8tion.jda.core.entities.Guild)1 Message (net.dv8tion.jda.core.entities.Message)1 MessageChannel (net.dv8tion.jda.core.entities.MessageChannel)1 User (net.dv8tion.jda.core.entities.User)1 Subcommand (tk.ardentbot.core.executor.Subcommand)1