From e115808e540996267a4bfefb6cc19f82d6d65e47 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Sun, 2 Jul 2017 15:38:42 +0200 Subject: [PATCH] Did lots of stuff. --- pom.xml | 2 +- .../handiebot/command/commands/misc/TengwarCommand.java | 6 +++--- .../handiebot/command/commands/music/RepeatCommand.java | 2 +- .../handiebot/command/commands/music/ShuffleCommand.java | 2 +- src/main/java/handiebot/utils/DisappearingMessage.java | 5 +++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index aa9be7f..31b0c1b 100644 --- a/pom.xml +++ b/pom.xml @@ -70,7 +70,7 @@ com.github.andrewlalis TengwarTranslatorLibrary - 1.1 + 1.2 diff --git a/src/main/java/handiebot/command/commands/misc/TengwarCommand.java b/src/main/java/handiebot/command/commands/misc/TengwarCommand.java index 5d05cc1..527c7cf 100644 --- a/src/main/java/handiebot/command/commands/misc/TengwarCommand.java +++ b/src/main/java/handiebot/command/commands/misc/TengwarCommand.java @@ -31,15 +31,15 @@ public class TengwarCommand extends ContextCommand { String result = Translator.translateToTengwar(input); try { context.getChannel().sendFile("Raw text: `" +result+'`', TengwarImageGenerator.generateImage(result, - 400, - 20f, + 600, + 24f, false, false, System.getProperty("user.home")+"/.handiebot/tengwarTemp.png")); } catch (FileNotFoundException e) { e.printStackTrace(); } - } else if (context.getArgs()[0].equalsIgnoreCase("to")){ + } else if (context.getArgs()[0].equalsIgnoreCase("from")){ context.getChannel().sendMessage(Translator.translateToEnglish(input)); } } else { diff --git a/src/main/java/handiebot/command/commands/music/RepeatCommand.java b/src/main/java/handiebot/command/commands/music/RepeatCommand.java index 97fa33c..fc33c21 100644 --- a/src/main/java/handiebot/command/commands/music/RepeatCommand.java +++ b/src/main/java/handiebot/command/commands/music/RepeatCommand.java @@ -25,7 +25,7 @@ public class RepeatCommand extends ContextCommand { @Override public void execute(CommandContext context) { if (context.getArgs().length == 1 && Commands.hasPermission(context, 8)){ - boolean shouldRepeat = Boolean.getBoolean(context.getArgs()[0].toLowerCase()); + boolean shouldRepeat = (context.getArgs()[0].toLowerCase().equals("true")); HandieBot.musicPlayer.setRepeat(context.getGuild(), shouldRepeat); } else { context.getChannel().sendMessage(MessageFormat.format(resourceBundle.getString("player.getRepeat"), HandieBot.musicPlayer.isRepeating(context.getGuild()))); diff --git a/src/main/java/handiebot/command/commands/music/ShuffleCommand.java b/src/main/java/handiebot/command/commands/music/ShuffleCommand.java index 9ba9d24..3b7e7c6 100644 --- a/src/main/java/handiebot/command/commands/music/ShuffleCommand.java +++ b/src/main/java/handiebot/command/commands/music/ShuffleCommand.java @@ -25,7 +25,7 @@ public class ShuffleCommand extends ContextCommand { @Override public void execute(CommandContext context) { if (context.getArgs().length == 1 && Commands.hasPermission(context, 8)){ - boolean shouldShuffle = Boolean.getBoolean(context.getArgs()[0].toLowerCase()); + boolean shouldShuffle = (context.getArgs()[0].toLowerCase().equals("true")); HandieBot.musicPlayer.setShuffle(context.getGuild(), shouldShuffle); } else { context.getChannel().sendMessage(MessageFormat.format(resourceBundle.getString("player.getShuffle"), HandieBot.musicPlayer.isShuffling(context.getGuild()))); diff --git a/src/main/java/handiebot/utils/DisappearingMessage.java b/src/main/java/handiebot/utils/DisappearingMessage.java index 82aec7a..fa54382 100644 --- a/src/main/java/handiebot/utils/DisappearingMessage.java +++ b/src/main/java/handiebot/utils/DisappearingMessage.java @@ -5,6 +5,7 @@ import handiebot.view.BotLog; import sx.blah.discord.handle.obj.IChannel; import sx.blah.discord.handle.obj.IMessage; import sx.blah.discord.handle.obj.Permissions; +import sx.blah.discord.util.RequestBuffer; import static handiebot.HandieBot.log; import static handiebot.HandieBot.resourceBundle; @@ -29,7 +30,7 @@ public class DisappearingMessage extends Thread implements Runnable { e.printStackTrace(); } if (canDelete(sentMessage)) - sentMessage.delete(); + RequestBuffer.request(() -> sentMessage.delete()); } /** @@ -45,7 +46,7 @@ public class DisappearingMessage extends Thread implements Runnable { e.printStackTrace(); } if (canDelete(message)) - message.delete(); + RequestBuffer.request(() -> message.delete()); }).start(); }