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


Java CommandEvent.replySuccess方法代码示例

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


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

示例1: execute

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event)
{
    String args = event.getArgs();

    if(args.isEmpty())
    {
        event.replyWarning("Please specify a timezone!");
        return;
    }

    try
    {
        ZoneId.of(args);
    }
    catch(ZoneRulesException e)
    {
        event.replyError("Please specify a valid timezone!");
        return;
    }

    db.setTimezone(event.getAuthor(), args);
    event.replySuccess("Successfully updated timezone!");
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:25,代码来源:TimeFor.java

示例2: execute

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent e) {
    if (C.hasRole(e.getMember(), Roles.RECRUITER)) {
        if (e.getMessage().getMentionedUsers().size() == 1) {
            e.reply("Please wait while we look how to demote " + C.getMentionedMember(e).getAsMention() + "!");
            Member member = C.getMentionedMember(e);
            if (!C.hasRole(member, Roles.HELPER)) {
                e.replyError("User is not on the staff team!");
                return;
            }
            removeIfHasRole(member, Roles.SUPER_ADMIN);
            removeIfHasRole(member, Roles.ADMIN);
            removeIfHasRole(member, Roles.MODERATOR);
            removeIfHasRole(member, Roles.HELPER);
            e.replySuccess("User has been demoted!");
        } else {
            e.replyError("**Correct Usage:** ^" + name + " " + arguments);
        }
    } else {
        e.replyError(C.permMsg(Roles.RECRUITER));
    }
}
 
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:23,代码来源:DemoteCommand.java

示例3: execute

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent e) {
    if (C.hasRole(e.getMember(), Roles.HELPER)) {
        if (e.getMessage().getMentionedUsers().size() == 1) {
            Member u = C.getMentionedMember(e);
            if (C.hasRole(u, Roles.EXP_SPAMMER)) {
                C.removeRole(u, Roles.EXP_SPAMMER);
                e.replySuccess(u.getUser().getAsMention() + " is no longer an EXP Spammer!");
            } else {
                C.giveRole(u, Roles.EXP_SPAMMER);
                e.replySuccess(u.getUser().getAsMention() + " has become an EXP Spammer!");
                C.privChannel(C.getMentionedMember(e), "You have become an EXP Spammer! Please ask to get this removed 1 week from now!");
            }
        } else {
            e.replyError("**Correct Usage:** ^" + name + " " + arguments);
        }
    } else {
        e.replyError(C.permMsg(Roles.HELPER));
    }
}
 
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:21,代码来源:SpamCommand.java

示例4: execute

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent commandEvent) {
    if (commandEvent.getArgs().isEmpty()) {
        commandEvent.replyWarning("You must enter some things for me to choose from...");
    }
    else {
        String[] items = commandEvent.getArgs().split("\\s+");

        if (items.length == 1) {
            commandEvent.replyWarning("Well I guess I must choose " + items[0]);
        }
        else {
            commandEvent.replySuccess("I choose `" + items[(int)(Math.random()*items.length)] + "`");
        }
    }

}
 
开发者ID:JessWalters,项目名称:Vinny-Redux,代码行数:18,代码来源:TestCommand.java

示例5: execute

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent e) {
    if (e.isOwner()) {
        if (e.getArgs().startsWith("instance")) {
            e.getMessage().addReaction("✅").queue();
            e.replySuccess(":white_check_mark: Stopping the JDA Instance!");
            e.getJDA().shutdown();
            Logger.log("The JDA instance has been shutdown.");
        } else if (e.getArgs().startsWith("vm")) {
            e.getMessage().addReaction("✅").queue();
            e.replySuccess(":white_check_mark: Stopping the VM!");
            e.getJDA().shutdown();
            Logger.log("The JDA instance has been shutdown...exiting the program.");
            System.exit(0);
        } else {
            e.replyError("**Correct Usage:** ^" + name + " " + arguments);
        }
    } else {
        e.replyError(C.permMsg(Roles.DEVELOPER));
    }
}
 
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:22,代码来源:ShutdownCommand.java

示例6: execute

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event) {
    if (event.isFromType(ChannelType.TEXT)) {
        String id = Constant.getTextChannelConf().getProperty(event.getGuild().getId());
        if (id != null) {
            if (!event.getChannel().getId().equals(id)) {
                return;
            }
        }
    }
    int res = Constant.music.disconnectFromVoiceChat(event.getGuild().getAudioManager());
    if (res == 0) {
        event.replyWarning(event.getMember().getAsMention() + " I'm not even connected :joy:");
    } else {
        event.replySuccess("Disconnected");
    }
}
 
开发者ID:elgoupil,项目名称:GoupilBot,代码行数:18,代码来源:DisconnectCommand.java

示例7: execute

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event)
{
    try
    {
        event.getJDA().getPresence().setGame(Game.playing("Type "+event.getClient().getPrefix()+"help | Version " + Const.VERSION + " | On " + event.getJDA().getGuilds().size() + " Guilds | " + event.getJDA().getUsers().size() + " Users | " + event.getJDA().getTextChannels().size() + " Channels"));
        event.replySuccess("Game updated.");
    }
    catch(Exception e)
    {
        event.replyError("Error when updating the game! Check the Bot console for more information.");
        e.printStackTrace();
    }
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:15,代码来源:BotCPanel.java

示例8: execute

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event)
{
    if(event.getArgs().isEmpty())
    {
        event.replyWarning("Specify a new welcome message!");
        return;
    }

    db.setWelcomeMessage(event.getGuild(), event.getArgs());
    event.replySuccess("Welcome message configured.");
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:13,代码来源:Welcome.java

示例9: execute

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent e) {
    if (C.hasRole(e.getMember(), Roles.RECRUITER)) {
        if (!e.getArgs().isEmpty()) {
            if (e.getArgs().startsWith("deny ")) {
                if (e.getMessage().getMentionedUsers().size() == 1) {
                    C.privChannel(C.getMentionedMember(e),
                            "Hey! I am sorry to say but your application has been denied due to **lack of detail**. You may reapply in 5 days!");
                    e.replySuccess("Application Denied!");
                } else {
                    e.replyError("^staffmng <deny/deny-level/approve> <user>");
                }
            } else if (e.getArgs().startsWith("deny-level ")) {
                if (e.getMessage().getMentionedUsers().size() == 1) {
                    C.privChannel(C.getMentionedMember(e),
                            "Hey! I am sorry to say but your application has been denied due to lack of **community involvement**. You may reapply in 5 days!");
                    e.replySuccess("Application Denied!");
                } else {
                    e.replyError("^staffmng <deny/deny-level/approve> <user>");
                }
            } else if (e.getArgs().startsWith("approve ")) {
                C.privChannel(C.getMentionedMember(e),
                        "Hey! I am sorry to say but your application has been APPROVED!!!111 Your rank will be applied very soon ;)");
                e.replySuccess("Application Approved!");
            } else {
                e.replyError("**Correct Usage:** ^" + name + " " + arguments);
            }
        } else {
            e.replyError("**Correct Usage:** ^" + name + " " + arguments);
        }
    } else {
        e.replyError(C.permMsg(Roles.RECRUITER));
    }
}
 
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:35,代码来源:StaffManagementCommand.java

示例10: execute

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event)
{
    Guild guild = event.getGuild();
    String msg = db.getLeaveMessage(guild);

    if(!(msg==null))
        event.replySuccess("Leave message at **"+guild.getName()+"**: `"+msg+"`");
    else
        event.replyError("No message configured!");
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:12,代码来源:Leave.java

示例11: execute

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event)
{
    String[] args;
    String name;
    String content;

    if(event.getArgs().isEmpty())
    {
        event.replyWarning("Please specify a tag name and content!");
        return;
    }

    try
    {
        args = event.getArgs().split(" ", 2);
        name = args[0].trim().toLowerCase();
        content = args[1].trim();
    }
    catch(ArrayIndexOutOfBoundsException e)
    {
        event.replyWarning("Please specify a tag name and content!");
        return;
    }

    String tag = db.getTagContent(name);

    if(tag==null)
    {
        db.addTag(name, content, event.getAuthor().getIdLong());
        event.replySuccess("Tag `"+name+"` was created successfully!");
    }
    else
        event.replyError("A tag already exists with that name!");
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:36,代码来源:Tag.java

示例12: execute

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event) {
    event.replySuccess("Alright! Let's set up your giveaway! First, what channel do you want the giveaway in?\n"
            + "You can type `cancel` at any time to cancel creation."+CHANNEL);
    waitForChannel(event);
}
 
开发者ID:jagrosh,项目名称:GiveawayBot,代码行数:7,代码来源:CreateCommand.java

示例13: execute

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event)
{
    if(!(event.getClient().getOwnerId().equals(Const.ARTUTO_ID)))
    {
        event.replyError("This command is not available on a selfhosted instance!");
        return;
    }

    if(event.getArgs().isEmpty())
    {
        event.replyWarning("Please specify the user ID!");
        return;
    }

    User user;
    List<Member> list = FinderUtil.findMembers(event.getArgs(), event.getGuild());

    if(list.isEmpty())
    {
        event.getJDA().retrieveUserById(event.getArgs()).queue(s -> {
            if(!(db.hasDonated(s)))
            {
                db.setDonation(s, null);
                event.replyError("This user hasn't donated!");
            }
            else
            {
                db.setDonation(s, null);
                event.replySuccess(String.format("Successfully removed %#s from the donators list!", s));
            }
        }, e -> event.replyError("Invalid ID!"));
    }
    else if(list.size()>1)
        event.replyWarning(FormatUtil.listOfMembers(list, event.getArgs()));
    else
    {
        user = list.get(0).getUser();

        if(!(db.hasDonated(user)))
        {
            db.setDonation(user, null);
            event.replyError("This user hasn't donated!");
        }
        else
        {
            db.setDonation(user, null);
            event.replySuccess(String.format("Successfully removed %#s from the donators list!", user));
        }
    }
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:52,代码来源:Donate.java

示例14: execute

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event) 
{
    String importString = "";
    String eval;
    
    try
    {
        engine.put("event", event);
        engine.put("jda", event.getJDA());
        engine.put("channel", event.getChannel());
        engine.put("message", event.getMessage());
        engine.put("bot", event.getSelfUser());
        engine.put("client", event.getClient());
        engine.put("author", event.getAuthor());
        engine.put("ddm", ddm);
        engine.put("bdm", bdm);
        engine.put("gsdm", gsdm);
        engine.put("tdm", tdm);
        engine.put("db", db);
        engine.put("config", config);
        engine.put("modlog", modlog);
        if(event.isFromType(ChannelType.TEXT))
        {
            engine.put("member", event.getMember());
            engine.put("guild", event.getGuild());
            engine.put("tc", event.getTextChannel());
            engine.put("selfmember", event.getGuild().getSelfMember());
        }

        for(final String s : imports)
            importString += "import "+ s + ".*;";

        eval = event.getArgs().replaceAll("getToken", "getSelfUser");
        Object out = engine.eval(importString + eval);

        if(out==null || String.valueOf(out).isEmpty())
            event.reactSuccess();
        else
            event.replySuccess("Done! Output:\n```"+out.toString().replaceAll(event.getJDA().getToken(), "Nice try.")+"```");
    } 
    catch(ScriptException e2)
    {
        event.replyError("Error! Output:\n```"+e2+" ```");
    }
}
 
开发者ID:EndlessBot,项目名称:Endless,代码行数:47,代码来源:Eval.java

示例15: execute

import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent e) {
    if (C.hasRole(e.getMember(), Roles.HELPER)) {
        if (e.getArgs().isEmpty()) {
            e.replyError("**Correct Usage:** ^" + name + " " + arguments);
            return;
        }

        String[] args = e.getArgs().split("[ ]");

        if (args.length < 1) {
            e.replyError("**Correct Usage:** ^" + name + " " + arguments);
            return;
        }

        String reason =  e.getArgs().replaceFirst(args[0] + " ", "");

        if (!StringUtils.isNumeric(args[0]) || reason.isEmpty()) {
            e.replyError("**Correct Usage:** ^" + name + " " + arguments);
            return;
        }

        int targetReport = Integer.parseInt(args[0]);

        if (!reportManager.isValidReport(targetReport)) {
            e.replyError("Invalid Report ID!");
            return;
        }

        ReportToken token = reportManager.getReportAsToken(targetReport);

        if (token == null) {
            e.replyError("Could not fetch the report data!");
            return;
        }

        if (token.getStatus() == 0) {
            e.replyError("This report is currently still pending, please handle the report first!");
            return;
        }

        if (!token.getHandler().getId().equals(e.getMember().getUser().getId()) && !C.hasRole(e.getMember(), Roles.DEVELOPER)) {
            e.replyError("You may not edit another user's report handle reasons! (Dev+)");
            return;
        }

        reportManager.setHandleReason(targetReport, reason);

        e.replySuccess("Updated the handle reason!");

    } else {
        e.replyError(C.permMsg(Roles.HELPER));
    }
}
 
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:55,代码来源:EditReportCommand.java


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