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


Java Command类代码示例

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


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

示例1: formatHelp

import com.jagrosh.jdautilities.commandclient.Command; //导入依赖的package包/类
public static String formatHelp(CommandEvent event)
{
    StringBuilder builder = new StringBuilder(Constants.YAY+" __**"+event.getSelfUser().getName()+"** commands:__\n");
    Category category = null;
    for(Command command : event.getClient().getCommands())
        if(!command.isOwnerCommand() || event.getAuthor().getId().equals(event.getClient().getOwnerId())){
            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());
        }
    builder.append("\n\nDo not include <> nor [] - <> means required and [] means optional."
                + "\nFor additional help, contact **jagrosh**#4824 or check out http://giveawaybot.party");
    return builder.toString();
}
 
开发者ID:jagrosh,项目名称:GiveawayBot,代码行数:19,代码来源:FormatUtil.java

示例2: initCommands

import com.jagrosh.jdautilities.commandclient.Command; //导入依赖的package包/类
public static void initCommands()
{
    //addCommand(new PingCommand());
    addCommands(new Command[]{
            new CommandHello(),
            new CommandConfig(),
            new CommandUsage(),
            new CommandRandQuote(),
            new CommandManagePoints(),
            new CommandGetUsersList(),
            new CommandTraffic(),
            new CommandAcceptRules(),
            new CommandGetRolesList(),
            new CommandMute(),
            new CommandUnmute(),
            new CommandAnnounce(),
            new CommandTimeZone(),
            new CommandShutdown(),
            new CommandDebug(),
            new CommandRules()
        }
    );
}
 
开发者ID:thebrightspark,项目名称:MDC-Discord-Bot,代码行数:24,代码来源:MDCBot.java

示例3: 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

示例4: GameBotCommand

import com.jagrosh.jdautilities.commandclient.Command; //导入依赖的package包/类
public GameBotCommand() {
    this.name = "gamebot";
    this.aliases = new String[]{"gb"};
    this.help = "type " + Constant.prefix + "gameBot help";
    this.helpBiConsumer = (CommandEvent event, Command command) -> {
        EmbedBuilder builder = new EmbedBuilder();
        builder.setColor(event.isFromType(ChannelType.TEXT) ? event.getSelfMember().getColor() : Color.GREEN);
        builder.setFooter(event.getSelfUser().getName(), event.getSelfUser().getAvatarUrl());
        builder.setTitle("The \"Game Bot\" Feature");
        builder.setDescription("The \"Game Bot\" feature is quite simple:");
        builder.addField("1.", "If you're playing a game, you just have to go in the server's game channel and react with :ok: in the bot channel", false);
        builder.addField("2.", "After that you'll be moved in a channel with the name of your game", false);
        builder.addField("3.", "If you leave the channel, it will automatically delete the channel", false);
        builder.setImage(Constant.gameBotExampleUrl);
        event.reply(builder.build());
    };
    this.guildOnly = false;
    this.ownerCommand = false;
}
 
开发者ID:elgoupil,项目名称:GoupilBot,代码行数:20,代码来源:GameBotCommand.java

示例5: 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

示例6: getHelpCard

import com.jagrosh.jdautilities.commandclient.Command; //导入依赖的package包/类
protected static MessageEmbed getHelpCard(CommandEvent e, Command c) {
    EmbedBuilder eb = new EmbedBuilder().setColor(e.getGuild().getMember(e.getJDA().getSelfUser()).getColor());
    eb.setTitle(c.getName().substring(0, 1).toUpperCase() + c.getName().substring(1) + " Command Help Card:", null);
    String argument = c.getArguments() == null ? "" : c.getArguments();
    eb.addField("Usage", e.getClient().getPrefix() + c.getName() + " " + argument, false);
    eb.addField("Description", c.getHelp(), false);
    String r;
    if (c.getAliases().length == 0)
        r = Locale.getCommandMessage("no-alias").finish();
    else
        r = Arrays.toString(c.getAliases()).replaceAll("\\[", "").replaceAll("]", "");
    eb.addField("Alias", r, false);
    String permission = c.getUserPermissions().length < 1 ? "None" : Arrays.toString(c.getUserPermissions());
    if (c.isOwnerCommand())
        permission = "OWNER";
    if (c.getCategory().equals(Bot.ADMIN))
        permission = "ADMIN";
    eb.addField("Permission", "Required Permission: " + permission, false);
    return eb.build();
}
 
开发者ID:CyR1en,项目名称:Minecordbot,代码行数:21,代码来源:MCBCommand.java

示例7: PlaylistCmd

import com.jagrosh.jdautilities.commandclient.Command; //导入依赖的package包/类
public PlaylistCmd(Bot bot)
{
    this.bot = bot;
    this.category = bot.OWNER;
    this.ownerCommand = true;
    this.guildOnly = false;
    this.name = "playlist";
    this.arguments = "<append|delete|make|setdefault>";
    this.help = "playlist management";
    this.children = new Command[]{
        new ListCmd(),
        new AppendlistCmd(),
        new DeletelistCmd(),
        new MakelistCmd(),
        new DefaultlistCmd()
    };
}
 
开发者ID:jagrosh,项目名称:MusicBot,代码行数:18,代码来源:PlaylistCmd.java

示例8: BotCPanel

import com.jagrosh.jdautilities.commandclient.Command; //导入依赖的package包/类
public BotCPanel()
{
    this.name = "bot";
    this.help = "Controls the status, game, optimized the bot and other useful things.";
    this.category = Categories.BOTADM;
    this.children = new Command[]{new Status(), new Playing(), new DefaultGameUpdate(), new Optimize()};
    this.botPermissions = new Permission[]{Permission.MESSAGE_WRITE};
    this.userPermissions = new Permission[]{Permission.MESSAGE_WRITE};
    this.ownerCommand = true;
    this.guildOnly = false;
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:12,代码来源:BotCPanel.java

示例9: BlacklistUsers

import com.jagrosh.jdautilities.commandclient.Command; //导入依赖的package包/类
public BlacklistUsers(BlacklistDataManager db)
{
    this.db = db;
    this.name = "blacklistuser";
    this.help = "Adds, removes or displays the list with blacklisted users.";
    this.category = Categories.BOTADM;
    this.children = new Command[]{new Add(), new Remove(), new Check(), new BlacklistList()};
    this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS};
    this.userPermissions = new Permission[]{Permission.MESSAGE_WRITE};
    this.ownerCommand = true;
    this.guildOnly = false;
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:13,代码来源:BlacklistUsers.java

示例10: TimeFor

import com.jagrosh.jdautilities.commandclient.Command; //导入依赖的package包/类
public TimeFor(ProfileDataManager db)
{
    this.db = db;
    this.name = "timefor";
    this.aliases = new String[]{"tf"};
    this.children = new Command[]{new Change(), new TList()};
    this.help = "Shows the timezone for the specified user";
    this.arguments = "<user>";
    this.category = Categories.UTILS;
    this.botPermissions = new Permission[]{Permission.MESSAGE_WRITE};
    this.userPermissions = new Permission[]{Permission.MESSAGE_WRITE};
    this.ownerCommand = false;
    this.guildOnly = true;
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:15,代码来源:TimeFor.java

示例11: Welcome

import com.jagrosh.jdautilities.commandclient.Command; //导入依赖的package包/类
public Welcome(GuildSettingsDataManager db)
{
    this.db = db;
    this.name = "welcome";
    this.children = new Command[]{new Change()};
    this.aliases = new String[]{"welcomemessage", "welcomemsg"};
    this.help = "Changes or shows the welcome message";
    this.category = Categories.TOOLS;
    this.botPermissions = new Permission[]{Permission.MESSAGE_WRITE};
    this.userPermissions = new Permission[]{Permission.MESSAGE_WRITE};
    this.ownerCommand = false;
    this.guildOnly = true;
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:14,代码来源:Welcome.java

示例12: RoleCmd

import com.jagrosh.jdautilities.commandclient.Command; //导入依赖的package包/类
public RoleCmd()
{
    this.name = "role";
    this.help = "Displays info about the specified role";
    this.arguments = "<role>";
    this.children = new Command[]{new GiveRole(), new TakeRole()};
    this.category = Categories.TOOLS;
    this.botPermissions = new Permission[]{Permission.MESSAGE_WRITE};
    this.userPermissions = new Permission[]{Permission.MESSAGE_WRITE};
    this.ownerCommand = false;
    this.guildOnly = true;
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:13,代码来源:RoleCmd.java

示例13: ServerSettings

import com.jagrosh.jdautilities.commandclient.Command; //导入依赖的package包/类
public ServerSettings(GuildSettingsDataManager db)
{
    this.db = db;
    this.name = "config";
    this.children = new Command[]{new ModLog(), new ServerLog(), new Welcome(), new Leave()};
    this.aliases = new String[]{"settings"};
    this.help = "Displays the settings of the server";
    this.category = Categories.TOOLS;
    this.botPermissions = new Permission[]{Permission.MESSAGE_WRITE};
    this.userPermissions = new Permission[]{Permission.MANAGE_SERVER};
    this.ownerCommand = false;
    this.guildOnly = true;
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:14,代码来源:ServerSettings.java

示例14: 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

示例15: 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


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