当前位置: 首页>>代码示例>>Java>>正文


Java Command.Category方法代码示例

本文整理汇总了Java中com.jagrosh.jdautilities.commandclient.Command.Category方法的典型用法代码示例。如果您正苦于以下问题:Java Command.Category方法的具体用法?Java Command.Category怎么用?Java Command.Category使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jagrosh.jdautilities.commandclient.Command的用法示例。


在下文中一共展示了Command.Category方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showHelp

import com.jagrosh.jdautilities.commandclient.Command; //导入方法依赖的package包/类
/**
 * Sends the help message for the registered commands.
 *
 * @param event The {@link com.jagrosh.jdautilities.commandclient.CommandEvent CommandEvent} that handles the reply.
 * @return The help message.
 */
public static String showHelp(CommandEvent event) {
    event.replySuccess("Help is on the way! :sparkles:");
    StringBuilder builder = new StringBuilder("**" + event.getSelfUser().getName() + "** commands:\n");
    Command.Category category = null;
    for (Command command : event.getClient().getCommands())
        if (!command.isOwnerCommand() || event.isOwner() || event.isCoOwner()) {
            if (!Objects.equals(category, command.getCategory())) {
                category = command.getCategory();
                builder.append("\n\n  __").append(category == null ? "No Category" : category.getName()).append("__:\n");
            }
            builder.append("\n`").append(event.getClient().getPrefix()).append(command.getName())
                    .append(command.getArguments() == null ? "`" : " " + command.getArguments() + "`")
                    .append(" **-** ").append(command.getHelp());
        }
    User owner = event.getJDA().getUserById(event.getClient().getOwnerId());
    if (owner != null) {
        builder.append("\n\nFor additional help, contact **").append(owner.getName()).append("**#").append(owner.getDiscriminator());

    }
    return builder.toString();
}
 
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:28,代码来源:C.java

示例2: listCommands

import com.jagrosh.jdautilities.commandclient.Command; //导入方法依赖的package包/类
private EmbedBuilder listCommands(EmbedBuilder ebi) {
    Command.Category[] categories = {Bot.ADMIN, Bot.FUN, Bot.HELP,
            Bot.INFO, Bot.MISC, Bot.OWNER};
    for (int i = 0; i <= categories.length - 1; i++) {
        StringBuilder str = new StringBuilder();
        if (getAllCommandsWithCategoryOf(categories[i]).size() != 0) {
            for (Command c : getAllCommandsWithCategoryOf(categories[i])) {
                str.append(getMcb().getBot().getClient().getPrefix()).append(c.getName())
                        .append(c.getArguments() == null ? "" : " " + c.getArguments())
                        .append(" - ").append(c.getHelp()).append("\n");
            }
            ebi.addField(" - " + categories[i].getName(), str.toString(), false);
        }
    }
    return ebi;
}
 
开发者ID:CyR1en,项目名称:Minecordbot,代码行数:17,代码来源:HelpCmd.java

示例3: ModLog

import com.jagrosh.jdautilities.commandclient.Command; //导入方法依赖的package包/类
public ModLog()
{
    this.name = "modlog";
    this.aliases = new String[]{"banlog", "kicklog", "banslog", "kickslog"};
    this.help = "Sets the modlog channel";
    this.arguments = "<#channel|Channel ID|Channel name>";
    this.category = new Command.Category("Settings");
    this.botPermissions = new Permission[]{Permission.MESSAGE_WRITE};
    this.userPermissions = new Permission[]{Permission.MANAGE_SERVER};
    this.ownerCommand = false;
    this.guildOnly = true;
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:13,代码来源:ServerSettings.java

示例4: ServerLog

import com.jagrosh.jdautilities.commandclient.Command; //导入方法依赖的package包/类
public ServerLog()
{
    this.name = "serverlog";
    this.help = "Sets the serverlog channel";
    this.arguments = "<#channel|Channel ID|Channel name>";
    this.category = new Command.Category("Settings");
    this.botPermissions = new Permission[]{Permission.MESSAGE_WRITE};
    this.userPermissions = new Permission[]{Permission.MANAGE_SERVER};
    this.ownerCommand = false;
    this.guildOnly = true;
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:12,代码来源:ServerSettings.java

示例5: Welcome

import com.jagrosh.jdautilities.commandclient.Command; //导入方法依赖的package包/类
public Welcome()
{
    this.name = "welcome";
    this.aliases = new String[]{"joinschannel", "joinslog", "joins"};
    this.help = "Sets the welcome channel";
    this.arguments = "<#channel|Channel ID|Channel name>";
    this.category = new Command.Category("Settings");
    this.botPermissions = new Permission[]{Permission.MESSAGE_WRITE};
    this.userPermissions = new Permission[]{Permission.MANAGE_SERVER};
    this.ownerCommand = false;
    this.guildOnly = true;
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:13,代码来源:ServerSettings.java

示例6: Leave

import com.jagrosh.jdautilities.commandclient.Command; //导入方法依赖的package包/类
public Leave()
{
    this.name = "leave";
    this.aliases = new String[]{"leaveschannel", "leaveslog", "leaves"};
    this.help = "Sets the leave channel";
    this.arguments = "<#channel|Channel ID|Channel name>";
    this.category = new Command.Category("Settings");
    this.botPermissions = new Permission[]{Permission.MESSAGE_WRITE};
    this.userPermissions = new Permission[]{Permission.MANAGE_SERVER};
    this.ownerCommand = false;
    this.guildOnly = true;
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:13,代码来源:ServerSettings.java

示例7: getAllCommandsWithCategoryOf

import com.jagrosh.jdautilities.commandclient.Command; //导入方法依赖的package包/类
private java.util.List<MCBCommand> getAllCommandsWithCategoryOf(Command.Category category) {
    ArrayList<MCBCommand> commands = new ArrayList<>();
    for (Command c : getMcb().getBot().getClient().getCommands()) {
        if (c.getCategory().equals(category))
            commands.add((MCBCommand) c);
    }
    Collections.sort(commands);
    return commands;
}
 
开发者ID:CyR1en,项目名称:Minecordbot,代码行数:10,代码来源:HelpCmd.java


注:本文中的com.jagrosh.jdautilities.commandclient.Command.Category方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。