Search in sources :

Example 1 with Module

use of com.github.vaerys.commands.admin.Module in project DiscordSailv2 by Vaerys-Dawn.

the class ModulesStage method stepText.

@Override
public void stepText(CommandObject command) {
    StringHandler output = new StringHandler();
    List<GuildToggle> modules = ToggleInit.getToggles(true);
    output.append("First things first. Obviously.\n");
    output.append("You're going to want to choose which modules you would like to use on your server.\n\n");
    output.append("**Here's a list of modules I have for you to choose from:**\n");
    String moduleItemFormat = "\t> **%s** - %s\n";
    modules.sort(Comparator.comparing(GuildToggle::toString));
    for (GuildToggle module : modules) {
        output.appendFormatted(moduleItemFormat, module.name(), module.shortDesc(command));
    }
    String toggleReminder = "\nYou can toggle a module on and off with the `%s` command.\nIf you want more detailed information about the module, you can use `%s`";
    output.appendFormatted(toggleReminder, new Module().getUsage(command), new HelpModules().getUsage(command));
    // RequestHandler.sendMessage(output.toString(), command.user.getDmChannel());
    XEmbedBuilder embed = new XEmbedBuilder(command);
    StringHandler enabled = new StringHandler();
    StringHandler disabled = new StringHandler();
    for (GuildToggle m : modules) {
        if (m.enabled(command.guild.config)) {
            enabled.append(m.name() + "\n");
        } else {
            disabled.append(m.name() + "\n");
        }
    }
    embed.withTitle("Here's the current list of enabled and disabled modules");
    embed.appendField("Enabled Modules", enabled.toString(), true);
    embed.appendField("Disabled Modules", disabled.toString(), true);
    // embed.send(command.user.getDmChannel());
    RequestHandler.sendEmbedMessage(output.toString(), embed, command.channel);
}
Also used : XEmbedBuilder(com.github.vaerys.objects.XEmbedBuilder) GuildToggle(com.github.vaerys.templates.GuildToggle) HelpModules(com.github.vaerys.commands.help.HelpModules) StringHandler(com.github.vaerys.handlers.StringHandler) Module(com.github.vaerys.commands.admin.Module)

Aggregations

Module (com.github.vaerys.commands.admin.Module)1 HelpModules (com.github.vaerys.commands.help.HelpModules)1 StringHandler (com.github.vaerys.handlers.StringHandler)1 XEmbedBuilder (com.github.vaerys.objects.XEmbedBuilder)1 GuildToggle (com.github.vaerys.templates.GuildToggle)1