本文整理汇总了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!");
}
示例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));
}
}
示例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));
}
}
示例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)] + "`");
}
}
}
示例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));
}
}
示例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");
}
}
示例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();
}
}
示例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.");
}
示例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));
}
}
示例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!");
}
示例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!");
}
示例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);
}
示例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));
}
}
}
示例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+" ```");
}
}
示例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));
}
}