本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}