diff --git a/src/corebot/Commands.java b/src/corebot/Commands.java index 7eac89ff..83b94368 100644 --- a/src/corebot/Commands.java +++ b/src/corebot/Commands.java @@ -89,7 +89,7 @@ public class Commands{ Info info = Info.valueOf(args[0]); messages.info(info.title, info.text); }catch(IllegalArgumentException e){ - messages.err("Error", "Invalid topic '@'.\nValid topics: *@*", args[0], Arrays.toString(Info.values())); + messages.err("Invalid topic '@'.\nValid topics: *@*", args[0], Arrays.toString(Info.values())); messages.deleteMessages(); } }); @@ -102,9 +102,9 @@ public class Commands{ try{ Document doc = Jsoup.connect(args[0]).get(); - EmbedBuilder builder = new EmbedBuilder().setColor(messages.normalColor). - setColor(messages.normalColor) - .setAuthor(messages.lastUser.getName(), messages.lastUser.getAvatarUrl(), messages.lastUser.getAvatarUrl()).setTitle(doc.select("strong[itemprop=name]").text()); + EmbedBuilder builder = new EmbedBuilder().setColor(messages.normalColor) + .setAuthor(messages.lastUser.getName(), messages.lastUser.getEffectiveAvatarUrl(), messages.lastUser.getEffectiveAvatarUrl()) + .setTitle(doc.select("strong[itemprop=name]").text()); Elements elem = doc.select("span[itemprop=about]"); if(!elem.isEmpty()){ @@ -115,7 +115,7 @@ public class Commands{ builder.addField("Downloads", args[0] + (args[0].endsWith("/") ? "" : "/") + "releases", false); - messages.channel.getGuild().getTextChannelById(pluginChannelID).sendMessage(builder.build()).queue(); + messages.guild.getTextChannelById(pluginChannelID).sendMessage(builder.build()).queue(); messages.text("*Plugin posted.*"); }catch(IOException e){ @@ -144,14 +144,14 @@ public class Commands{ Streams.copy(net.download(a.getUrl()), new FileOutputStream(mapFile)); ImageIO.write(map.image, "png", imageFile.file()); - EmbedBuilder builder = new EmbedBuilder().setColor(messages.normalColor).setColor(messages.normalColor) + EmbedBuilder builder = new EmbedBuilder().setColor(messages.normalColor) .setImage("attachment://" + imageFile.name()) - - .setAuthor(messages.lastUser.getName(), messages.lastUser.getAvatarUrl(), messages.lastUser.getAvatarUrl()).setTitle(map.name == null ? a.getFileName().replace(".msav", "") : map.name); + .setAuthor(messages.lastUser.getName(), messages.lastUser.getEffectiveAvatarUrl(), messages.lastUser.getEffectiveAvatarUrl()) + .setTitle(map.name == null ? a.getFileName().replace(".msav", "") : map.name); if(map.description != null) builder.setFooter(map.description); - messages.channel.getGuild().getTextChannelById(mapsChannelID).sendFile(mapFile).addFile(imageFile.file()).embed(builder.build()).queue(); + messages.guild.getTextChannelById(mapsChannelID).sendFile(mapFile).addFile(imageFile.file()).embed(builder.build()).queue(); messages.text("*Map posted successfully.*"); }catch(Exception e){ @@ -216,7 +216,6 @@ public class Commands{ Streams.copy(add.read(), zos); zos.closeEntry(); } - } messages.channel.sendFile(destFile.file()).queue(); @@ -424,7 +423,8 @@ void handle(Message message){ EmbedBuilder builder = new EmbedBuilder().setColor(messages.normalColor).setColor(messages.normalColor) .setImage("attachment://" + previewFile.getName()) - .setAuthor(message.getAuthor().getName(), message.getAuthor().getAvatarUrl(), message.getAuthor().getAvatarUrl()).setTitle(schem.name()); + .setAuthor(message.getAuthor().getName(), message.getAuthor().getEffectiveAvatarUrl(), message.getAuthor().getEffectiveAvatarUrl()) + .setTitle(schem.name()); if(!schem.description().isEmpty()) builder.setFooter(schem.description()); @@ -483,11 +483,10 @@ boolean handleResponse(CommandResponse response, boolean logUnknown){ }else if(response.type == ResponseType.manyArguments || response.type == ResponseType.fewArguments){ if(response.command.params.length == 0){ messages.err("Invalid arguments.", "Usage: @@", prefix, response.command.text); - messages.deleteMessages(); }else{ messages.err("Invalid arguments.", "Usage: @@ *@*", prefix, response.command.text, response.command.paramText); - messages.deleteMessages(); } + messages.deleteMessages(); return false; } return true; diff --git a/src/corebot/Messages.java b/src/corebot/Messages.java index 8d66f45f..a5e42b9f 100644 --- a/src/corebot/Messages.java +++ b/src/corebot/Messages.java @@ -130,17 +130,16 @@ public void sendCrash(JsonValue value){ builder.append("\n"); value = value.next; } - guild.getTextChannelById(CoreBot.crashReportChannelID).sendMessage(builder.toString()).queue(); + guild.getTextChannelById(crashReportChannelID).sendMessage(builder.toString()).queue(); } public void text(String text, Object... args){ - lastSentMessage = channel.sendMessage(format(text, args)).complete(); + lastSentMessage = channel.sendMessage(Strings.format(text, args)).complete(); } public void info(String title, String text, Object... args){ MessageEmbed object = new EmbedBuilder() - .addField(title, format(text, args), true).setColor(normalColor).build(); - + .setTitle(title).setDescription(Strings.format(text, args)).setColor(normalColor).build(); lastSentMessage = channel.sendMessage(object).complete(); } @@ -150,11 +149,7 @@ public void err(String text, Object... args){ public void err(String title, String text, Object... args){ MessageEmbed e = new EmbedBuilder() - .addField(title, format(text, args), true).setColor(errorColor).build(); + .setTitle(title).setDescription(Strings.format(text, args)).setColor(errorColor).build(); lastSentMessage = channel.sendMessage(e).complete(); } - - private String format(String text, Object... args){ - return Strings.format(text, args); - } }