本文整理汇总了Java中com.jagrosh.jdautilities.commandclient.CommandEvent.replyError方法的典型用法代码示例。如果您正苦于以下问题:Java CommandEvent.replyError方法的具体用法?Java CommandEvent.replyError怎么用?Java CommandEvent.replyError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jagrosh.jdautilities.commandclient.CommandEvent
的用法示例。
在下文中一共展示了CommandEvent.replyError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent e) {
if (C.hasRole(e.getMember(), Roles.ADMIN)) {
e.reply("Loading...");
int affected = 0;
for (Member curM : C.getGuild().getMembers()) {
if (!C.hasRole(curM, Roles.FANS) && !curM.getUser().isBot()) {
C.giveRole(curM, Roles.FANS);
affected++;
}
}
e.replySuccess("All Done!\n" + String.valueOf(affected) + " Users Affected!");
} else {
e.replyError(C.permMsg(Roles.ADMIN));
}
}
示例2: execute
import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event) {
try {
Constant.getTextChannelConf().get(event.getGuild().getId());
Properties p = Constant.getVoiceChannelConf();
if (p.getProperty(event.getGuild().getId()) == null) {
p.put(event.getGuild().getId(), "");
}
if (!event.getArgs().isEmpty()) {
p.replace(event.getGuild().getId(), event.getArgs());
} else {
p.remove(event.getGuild().getId());
}
Constant.writeVoiceChannelConf(p);
event.reactSuccess();
} catch (Exception e) {
event.replyError("Please set a text channel first.\nSee `"+Constant.prefix+"help setTextChannel`");
}
}
示例3: 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;
}
}
}
if (event.getGuild().getAudioManager().isConnected()) {
if (Constant.music.getGuildAudioPlayer(event.getGuild()).player.getPlayingTrack() != null) {
Constant.nowPlayingList.get(event.getGuild().getId()).resendNowPlaying();
} else {
event.replyWarning("I'm not playing anything");
}
}else{
event.replyError(event.getMember().getAsMention() + " I'm not even connected :joy:");
}
}
示例4: execute
import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent e) {
if (C.hasRole(e.getMember(), Roles.DEVELOPER)) {
if (e.getArgs().isEmpty()) {
e.replyError("**Correct Usage:** ^" + name + " " + arguments);
return;
}
if (themeManager.getThemes().contains(e.getArgs())) {
try {
C.writeFile("theme.yml", e.getArgs());
themeManager.switchTheme(e.getArgs());
Main.updateTheme();
e.replySuccess(":gear: Switching over to " + themeManager.asToken(e.getArgs()).getName() + " Theme!");
} catch (ThemeNotFoundException e1) {
e.replyError(":x: Error while switching themes: " + e1.getMessage());
}
} else {
e.replyError("**Correct Usage:** ^" + name + " " + arguments);
}
} else {
e.replyError(C.permMsg(Roles.DEVELOPER));
}
}
示例5: 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));
}
}
示例6: execute
import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event) {
if(!Constants.canSendGiveaway(event.getTextChannel()))
{
event.replyError("I cannot start a giveaway here; please make sure I have the following permissions:\n\n"+Constants.PERMS);
return;
}
String[] parts = event.getArgs().split("\\s+",2);
boolean minutes;
if(parts[0].toLowerCase().endsWith("m")) {
parts[0] = parts[0].substring(0,parts[0].length()-1);
minutes = true;
} else if (parts[0].toLowerCase().endsWith("s")) {
parts[0] = parts[0].substring(0,parts[0].length()-1);
minutes = false;
} else
minutes = false;
try {
int value = (int)(Double.parseDouble(parts[0]) * (minutes ? 60 : 1) );
if(!Constants.validTime(value))
{
event.replyWarning("Time must be at least 10 seconds and can't be longer than a week!");
return;
}
try{ event.getMessage().delete().queue(); }catch(PermissionException ex){}
Instant now = Instant.now();
String item = parts.length==1 ? null : (parts[1].length()>Constants.PRIZE_MAX ? parts[1].substring(0,Constants.PRIZE_MAX) : parts[1]);
bot.startGiveaway(event.getTextChannel(), now, value, 1, item);
} catch(NumberFormatException e) {
event.replyWarning("Failed to parse "+(minutes ? "minutes" : "seconds")+" from `"+parts[0]+"`.");
}
}
示例7: execute
import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent e) {
if (!e.getArgs().isEmpty()) {
if (C.containsMention(e)) {
e.replyError("**Correct Usage:** ^" + name + " " + arguments);
return;
}
if (hypixel.isValidPlayer(e.getArgs())) {
try {
HypixelPlayer player = hypixel.getPlayer(e.getArgs());
EmbedBuilder embed = new EmbedBuilder()
.setTitle("Hypixel Player Statistics")
.setDescription("Listing statistics:")
.setFooter("Stats provided by Hypixel's API", "https://media-curse.cursecdn.com/attachments/264/727/f7c76fdb4569546a9ddf0e58c8653823.png");
for (HashMap.Entry<String, String> entry : hypixel.getAllFields(player).entrySet()) {
if (entry.getValue() != null && !entry.getValue().equals("0")) {
embed.addField("**" + entry.getKey() + "**", entry.getValue(), true);
}
}
e.reply(embed.build());
} catch (APIException e1) {
e.replyError("The API had an error or the player was invalid.");
}
} else {
e.replyError("The API had an error or the player was invalid.");
}
} else {
e.replyError("**Correct Usage:** ^" + name + " " + arguments);
}
}
示例8: execute
import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent e) {
if (C.hasRole(e.getMember(), Roles.ADMIN)) {
try {
PermissionOverride permissionOverride = e.getTextChannel().getPermissionOverride(Roles.EVERYONE.getRole());
PermOverrideManager manager = permissionOverride.getManager();
manager.grant(Permission.MESSAGE_WRITE).queue();
e.replySuccess(":unlock: Channel has been unlocked!");
} catch (NullPointerException npe) {
e.replyError("An error occurred while un-locking the channel! Please make sure this channel is setup correctly.");
}
} else {
e.replyError(C.permMsg(Roles.ADMIN));
}
}
示例9: execute
import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event)
{
event.replySuccess("Here is the list: ");
try
{
event.getChannel().sendFile(new URL("https://endless.artuto.me/Timezones.txt").openStream(), "Timezones.txt", null).queue();
}
catch(IOException e)
{
event.replyError("Error when uploading the list, please visit **https://endless.artuto.me/Timezones.txt** to see the list.");
}
}
示例10: execute
import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event)
{
if(event.getArgs().isEmpty())
{
event.reply("Currently set to **"+mode.name()+"**");
return;
}
final Mode newMode;
try {
newMode = Mode.valueOf(event.getArgs().toUpperCase());
} catch(IllegalArgumentException e) {
event.replyError("Invalid Mode!");
return;
}
if(mode == newMode)
{
event.replyWarning("Already set to **"+mode.name()+"**!");
return;
}
if(newMode == Mode.DEBUG)
{
((LoggerContext)LoggerFactory.getILoggerFactory()).getLoggerList()
.forEach(logger -> logger.setLevel(Level.DEBUG));
}
if(mode == Mode.DEBUG)
{
((LoggerContext)LoggerFactory.getILoggerFactory()).getLoggerList()
.forEach(logger -> logger.setLevel(Level.INFO));
}
mode = newMode;
event.getClient().setListener(mode.listener);
event.replySuccess("Successfully set mode to **"+mode.name()+"**!");
}
示例11: execute
import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent event)
{
try
{
Color color;
if (event.isFromType(ChannelType.PRIVATE))
color = Color.decode("#33ff00");
else
color = event.getMember().getColor();
EmbedBuilder builder = new EmbedBuilder();
OkHttpClient client = new OkHttpClient();
Request req = new Request.Builder().url("https://random.dog/woof.json").get().build();
Response res = client.newCall(req).execute();
if(!res.isSuccessful())
throw new RuntimeException("Error while fetching remote resource");
ResponseBody body = res.body();
String data = body.string();
JSONObject json = new JSONObject(data);
String cat = json.getString("url");
builder.setAuthor("Requested by "+event.getAuthor().getName(), null, event.getAuthor().getEffectiveAvatarUrl());
builder.setImage(cat);
builder.setFooter("Image provided by random.dog API", null);
builder.setColor(color);
event.reply(builder.build());
}
catch(IOException | RuntimeException e)
{
event.replyError("An error was thrown when getting the image! Ask the Owner to check the Console.");
LOG.error(e.getMessage());
if (config.isDebugEnabled())
e.printStackTrace();
}
}
示例12: execute
import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent e) {
String randomVideo = C.urlExpand("https://mityurl.com/y/MEzr/r");
if (randomVideo != null) {
e.replySuccess("Here you go: " + randomVideo);
} else {
e.replyError("Sorry :cry:... The YouTube API is having a temporary hiccup.");
}
}
示例13: execute
import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
protected void execute(CommandEvent event)
{
String args = event.getArgs();
if(config.getGihpyKey().isEmpty())
{
event.replyError("This command has been disabled due a faulty parameter on the config file, ask the Owner to check the Console");
LOG.warn("Someone triggered the Giphy command, but there isn't a key in the config file. In order to stop this message add a key to the config file.");
return;
}
if(args.isEmpty())
{
event.replyWarning("No search terms specified!");
return;
}
Color color;
if(event.isFromType(ChannelType.PRIVATE))
color = Color.decode("#33ff00");
else
color = event.getMember().getColor();
SimpleGiphy.setApiKey(config.getGihpyKey());
RandomGiphyResponse r;
EmbedBuilder builder = new EmbedBuilder();
String title = "<:giphy:373675520099090436> Random Giphy Image:";
r = SimpleGiphy.getInstance().random(args, "pg-13");
RandomGiphy gif = r.getRandomGiphy();
builder.setImage(gif.getImageOriginalUrl());
builder.setFooter("GIF provided by Giphy API", "https://cdn.discordapp.com/attachments/304027425509998593/373674151472267265/Poweredby_640px_Badge.gif");
builder.setColor(color);
event.reply(new MessageBuilder().append(title).setEmbed(builder.build()).build());
}
示例14: execute
import com.jagrosh.jdautilities.commandclient.CommandEvent; //导入方法依赖的package包/类
@Override
protected void execute(CommandEvent e) {
if (!C.containsMention(e)) {
e.replyError("**Correct Usage:** ^" + name + " **<user>** <reason>");
return;
}
if (e.getArgs().replaceAll("<(.*?)>", "").isEmpty()) {
e.replyError("**Correct Usage:** ^" + name + " <user> **<reason>**");
return;
}
String reason = e.getArgs().replaceFirst("<(.*?)> ", "");
Member target = C.getMentionedMember(e);
try {
int id = reportManager.spawnReport(target.getUser().getId(), e.getMember().getUser().getId(), e.getChannel().getId(), reason);
Channels.REPORT.getChannel().sendMessage(new EmbedBuilder()
.setTitle("New Report")
.setDescription(":paperclip: " + C.bold("Report #" + String.valueOf(id) + " has been created.") + "\n:arrow_forward: " + C.bold("Reported User: ") + target.getAsMention() + "\n:arrow_forward: " + C.bold("Reporter: " + e.getMember().getAsMention()) + "\n:page_facing_up: " + C.bold("Reason: ") + C.smallCodeblock(reason) + "\n:hash: " + C.bold("Channel: <#" + e.getChannel().getId() + ">"))
.setColor(Color.GREEN)
.setThumbnail(target.getUser().getAvatarUrl())
.build()
).queue();
e.replySuccess("Submitted Report #" + String.valueOf(id) + " !");
} catch (SQLException e1) {
e.replyError("Oof Error: " + e1.getMessage());
}
}
示例15: 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!");
}