• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Command类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


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


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


示例18: Leave

import com.jagrosh.jdautilities.commandclient.Command; //导入依赖的package包/类
public Leave(GuildSettingsDataManager db)
{
    this.db = db;
    this.name = "leave";
    this.children = new Command[]{new Change()};
    this.aliases = new String[]{"leavemessage", "leavemsg"};
    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,代码来源:Leave.java


示例19: GiphyGif

import com.jagrosh.jdautilities.commandclient.Command; //导入依赖的package包/类
public GiphyGif(Config config)
{
    this.config = config;
    this.name = "giphy";
    this.aliases = new String[]{"gif"};
    this.children = new Command[]{new RandomGif()};
    this.help = "Searches a gif on Giphy using the specified serarch terms.";
    this.arguments = "[keyword]";
    this.category = Categories.FUN;
    this.botPermissions = new Permission[]{Permission.MESSAGE_WRITE, Permission.MESSAGE_EMBED_LINKS};
    this.userPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS};
    this.ownerCommand = false;
    this.guildOnly = false;
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:15,代码来源:GiphyGif.java


示例20: Tag

import com.jagrosh.jdautilities.commandclient.Command; //导入依赖的package包/类
public Tag(TagDataManager db)
{
    this.db = db;
    this.parser = new ParserBuilder()
            .addMethods(Variables.getMethods())
            .addMethods(Arguments.getMethods())
            .addMethods(Functional.getMethods())
            .addMethods(Miscellaneous.getMethods())
            .addMethods(Strings.getMethods())
            .addMethods(Time.getMethods())
            .addMethods(com.jagrosh.jagtag.libraries.Variables.getMethods())
            .setMaxOutput(2000)
            .setMaxIterations(1000)
            .build();
    this.name = "tag";
    this.aliases = new String[]{"t"};
    this.help = "Retrieves a tag with the specified name";
    this.helpBiConsumer = (event, command) -> {
        StringBuilder sb = new StringBuilder();
        sb.append("Help for **"+command.getName()+"**:\n");

        for(Command c : command.getChildren())
            sb.append("`"+event.getClient().getPrefix()+c.getName()+" "+c.getArguments()+"` - "+c.getHelp()+"\n");

        event.replyInDm(sb.toString());
        event.reactSuccess();
    };
    this.arguments = "<name>";
    this.children = new Command[]{new Add(), new Delete(), new Edit(), new Import(), new Owner(), new Raw(), new Raw2(), new UnImport()};
    this.category = Categories.FUN;
    this.botPermissions = new Permission[]{Permission.MESSAGE_WRITE};
    this.userPermissions = new Permission[]{Permission.MESSAGE_WRITE};
    this.ownerCommand = false;
    this.guildOnly = false;
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:36,代码来源:Tag.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LongOpenHashSet类代码示例发布时间:2022-05-21
下一篇:
Java HFile类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap