Search in sources :

Example 11 with CommandInfo

use of ws.nmathe.saber.commands.CommandInfo in project Saber-Bot by notem.

the class SortCommand method info.

@Override
public CommandInfo info(String prefix) {
    String head = prefix + this.name();
    String usage = "``" + head + "`` - reorder the schedule by start time";
    CommandInfo info = new CommandInfo(usage, CommandInfo.CommandType.MISC);
    String cat1 = "- Usage\n" + head + " <channel> [<order>]";
    String cont1 = "The sort command will re-sort the entries in a schedule." + "\nEntries can be reordered in either ascending or descending order by adding 'asc' or 'desc' to the command.\n" + "If the order is omitted from the command, the schedule will be sorted in ascending order." + "\n\n" + "The schedule cannot be modified while in the process of sorting.\n" + "If for some reason your schedule is not unlocked after 10 minutes, visit the support server!\n" + "For performance reasons, schedules with more than 15 entries will not be sorted.";
    info.addUsageCategory(cat1, cont1);
    info.addUsageExample(head + " #schedule");
    info.addUsageExample(head + " #schedule desc");
    return info;
}
Also used : CommandInfo(ws.nmathe.saber.commands.CommandInfo)

Example 12 with CommandInfo

use of ws.nmathe.saber.commands.CommandInfo in project Saber-Bot by notem.

the class HelpCommand method action.

@Override
public void action(String prefix, String[] args, MessageReceivedEvent event) {
    // send the bot intro with a brief list of commands to the user
    if (args.length < 1) {
        String intro = "```diff\n- Intro```\nI am **" + Main.getShardManager().getJDA().getSelfUser().getName() + "**, the event scheduling discord bot." + " I can provide your discord with basic event schedule management.\nInvite me to your discord and create " + "a dedicated command channel named **" + Main.getBotSettingsManager().getControlChan() + "** to get started.\n\n" + "github: <https://github.com/notem/Saber-Bot>\n" + "userdocs: <https://nmathe.ws/bots/saber>\n" + "support: <https://discord.gg/ZQZnXsC>\n" + "invite: <https://discordapp.com/api/oauth2/authorize?client_id=" + Main.getShardManager().getJDA().getSelfUser().getId() + "&scope=bot&permissions=523344>\n\n";
        // generate list of commands
        String commands = "```diff\n- Command List```\n";
        commands += "**Core commands**\n================\n";
        for (Command cmd : Main.getCommandHandler().getCommands()) {
            CommandInfo info = cmd.info(prefix);
            if (info.getType() == CommandInfo.CommandType.CORE)
                commands += info.getUsage() + "\n";
        }
        commands += "\n**User commands**\n================\n";
        for (Command cmd : Main.getCommandHandler().getCommands()) {
            CommandInfo info = cmd.info(prefix);
            if (info.getType() == CommandInfo.CommandType.USER)
                commands += info.getUsage() + "\n";
        }
        commands += "\n**Google commands**\n================\n";
        for (Command cmd : Main.getCommandHandler().getCommands()) {
            CommandInfo info = cmd.info(prefix);
            if (info.getType() == CommandInfo.CommandType.GOOGLE)
                commands += info.getUsage() + "\n";
        }
        commands += "\n**Misc commands**\n================\n";
        for (Command cmd : Main.getCommandHandler().getCommands()) {
            CommandInfo info = cmd.info(prefix);
            if (info.getType() == CommandInfo.CommandType.MISC)
                commands += info.getUsage() + "\n";
        }
        String boot = "\nTo view detailed information for any of the above commands, DM me ``help command``.";
        String msg = intro + commands + boot;
        MessageUtilities.sendPrivateMsg(msg, event.getAuthor(), null);
    } else // generate help info for the requested command
    {
        Command cmd = Main.getCommandHandler().getCommand(args[0]);
        if (cmd != null) {
            CommandInfo info = cmd.info(prefix);
            String msg = "";
            if (!info.getUsageExtended().keySet().isEmpty()) {
                for (String key : info.getUsageExtended().keySet()) {
                    msg += "```diff\n" + key + "```\n" + info.getUsageExtended().get(key) + "\n\n";
                    if (msg.length() > 1000) {
                        MessageUtilities.sendPrivateMsg(msg, event.getAuthor(), null);
                        msg = "";
                    }
                }
            }
            if (!info.getUsageExamples().isEmpty()) {
                msg += "```diff\n- Examples```";
                for (String example : info.getUsageExamples()) {
                    msg += "\n``" + example + "``";
                }
            }
            MessageUtilities.sendPrivateMsg(msg, event.getAuthor(), null);
        } else {
            String msg = "There is no command called *" + args[0] + "*!";
            MessageUtilities.sendPrivateMsg(msg, event.getAuthor(), null);
        }
    }
}
Also used : CommandInfo(ws.nmathe.saber.commands.CommandInfo) Command(ws.nmathe.saber.commands.Command)

Example 13 with CommandInfo

use of ws.nmathe.saber.commands.CommandInfo in project Saber-Bot by notem.

the class DeleteCommand method info.

@Override
public CommandInfo info(String prefix) {
    String cmd = prefix + this.name();
    String usage = "``" + cmd + "`` - remove schedules or events ";
    CommandInfo info = new CommandInfo(usage, CommandInfo.CommandType.CORE);
    String cat1 = "- Usage\n" + cmd + " <ID|channel|'all'>";
    String cont1 = "The delete command can be used to delete schedules or events.\n" + "The command's single argument may be an entry's ID, a schedule's channel, or ``all``." + "\nIf ``all`` is used all schedules will be deleted, use with caution.\n\n" + "The delete command is not required to remove messages or channels." + "\nManually deleting the event's message on the schedule channel" + " or deleting the entire schedule channel through discord suffices.";
    info.addUsageCategory(cat1, cont1);
    info.addUsageExample(cmd + " AOja9B");
    info.addUsageExample(cmd + " all");
    info.addUsageExample(cmd + " #events");
    return info;
}
Also used : CommandInfo(ws.nmathe.saber.commands.CommandInfo)

Example 14 with CommandInfo

use of ws.nmathe.saber.commands.CommandInfo in project Saber-Bot by notem.

the class AnnouncementsCommand method info.

@Override
public CommandInfo info(String prefix) {
    String head = prefix + this.name();
    String usage = "``" + head + "`` - list and configure event announcements";
    CommandInfo info = new CommandInfo(usage, CommandInfo.CommandType.MISC);
    String cat1 = "- Usage\n" + head + " <ID> [<add|remove> <args>]";
    String cont1 = "The ``announcements`` command will list all currently scheduled announcements for the event.\n" + "Announcements are divided into *Schedule* and *Event* announcements." + "\n\n" + "Schedule announcements can be modified using the ``config`` command.\n" + "Event announcements can be modified using either this command or the ``edit`` command." + "\n\n" + "Reference the command examples to see how to add and remove event-specific announcements.";
    info.addUsageCategory(cat1, cont1);
    info.addUsageExample(head + " J09DlA");
    info.addUsageExample(head + " J09DlA add #general start-1h \"Get ready! **%t** begins in one hour!\"");
    info.addUsageExample(head + " J09DlA remove 1");
    return info;
}
Also used : CommandInfo(ws.nmathe.saber.commands.CommandInfo)

Example 15 with CommandInfo

use of ws.nmathe.saber.commands.CommandInfo in project Saber-Bot by notem.

the class ManageCommand method info.

@Override
public CommandInfo info(String prefix) {
    String head = prefix + this.name();
    String usage = "``" + head + "`` - add or kick users from an event";
    CommandInfo info = new CommandInfo(usage, CommandInfo.CommandType.MISC);
    String cat1 = "- Usage\n" + head + " <id> <add|kick> <group> <@user>";
    String cont1 = "" + "This command may be used to manually add or remove particular users from an event's rsvp groups." + "\n\n" + "The ``<group>`` argument should be one of the RSVP groups configured for the schedule.\n" + "``<@user>`` should be an @mention for the user to be added/removed.\n" + "If ``<@user>`` is not an @mention for a user, a 'dummy' user will be used.";
    info.addUsageCategory(cat1, cont1);
    info.addUsageExample(head + " 10agj2 add Yes @Saber#9015");
    info.addUsageExample(head + " 10agj2 kick Yes @notem#1654");
    return info;
}
Also used : CommandInfo(ws.nmathe.saber.commands.CommandInfo)

Aggregations

CommandInfo (ws.nmathe.saber.commands.CommandInfo)20 Command (ws.nmathe.saber.commands.Command)1