Did lots of stuff.

This commit is contained in:
Andrew Lalis 2017-07-02 15:38:42 +02:00 committed by Andrew Lalis
parent bca2921e67
commit e115808e54
5 changed files with 9 additions and 8 deletions

View File

@ -70,7 +70,7 @@
<dependency> <dependency>
<groupId>com.github.andrewlalis</groupId> <groupId>com.github.andrewlalis</groupId>
<artifactId>TengwarTranslatorLibrary</artifactId> <artifactId>TengwarTranslatorLibrary</artifactId>
<version>1.1</version> <version>1.2</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -31,15 +31,15 @@ public class TengwarCommand extends ContextCommand {
String result = Translator.translateToTengwar(input); String result = Translator.translateToTengwar(input);
try { try {
context.getChannel().sendFile("Raw text: `" +result+'`', TengwarImageGenerator.generateImage(result, context.getChannel().sendFile("Raw text: `" +result+'`', TengwarImageGenerator.generateImage(result,
400, 600,
20f, 24f,
false, false,
false, false,
System.getProperty("user.home")+"/.handiebot/tengwarTemp.png")); System.getProperty("user.home")+"/.handiebot/tengwarTemp.png"));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} }
} else if (context.getArgs()[0].equalsIgnoreCase("to")){ } else if (context.getArgs()[0].equalsIgnoreCase("from")){
context.getChannel().sendMessage(Translator.translateToEnglish(input)); context.getChannel().sendMessage(Translator.translateToEnglish(input));
} }
} else { } else {

View File

@ -25,7 +25,7 @@ public class RepeatCommand extends ContextCommand {
@Override @Override
public void execute(CommandContext context) { public void execute(CommandContext context) {
if (context.getArgs().length == 1 && Commands.hasPermission(context, 8)){ 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); HandieBot.musicPlayer.setRepeat(context.getGuild(), shouldRepeat);
} else { } else {
context.getChannel().sendMessage(MessageFormat.format(resourceBundle.getString("player.getRepeat"), HandieBot.musicPlayer.isRepeating(context.getGuild()))); context.getChannel().sendMessage(MessageFormat.format(resourceBundle.getString("player.getRepeat"), HandieBot.musicPlayer.isRepeating(context.getGuild())));

View File

@ -25,7 +25,7 @@ public class ShuffleCommand extends ContextCommand {
@Override @Override
public void execute(CommandContext context) { public void execute(CommandContext context) {
if (context.getArgs().length == 1 && Commands.hasPermission(context, 8)){ 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); HandieBot.musicPlayer.setShuffle(context.getGuild(), shouldShuffle);
} else { } else {
context.getChannel().sendMessage(MessageFormat.format(resourceBundle.getString("player.getShuffle"), HandieBot.musicPlayer.isShuffling(context.getGuild()))); context.getChannel().sendMessage(MessageFormat.format(resourceBundle.getString("player.getShuffle"), HandieBot.musicPlayer.isShuffling(context.getGuild())));

View File

@ -5,6 +5,7 @@ import handiebot.view.BotLog;
import sx.blah.discord.handle.obj.IChannel; import sx.blah.discord.handle.obj.IChannel;
import sx.blah.discord.handle.obj.IMessage; import sx.blah.discord.handle.obj.IMessage;
import sx.blah.discord.handle.obj.Permissions; import sx.blah.discord.handle.obj.Permissions;
import sx.blah.discord.util.RequestBuffer;
import static handiebot.HandieBot.log; import static handiebot.HandieBot.log;
import static handiebot.HandieBot.resourceBundle; import static handiebot.HandieBot.resourceBundle;
@ -29,7 +30,7 @@ public class DisappearingMessage extends Thread implements Runnable {
e.printStackTrace(); e.printStackTrace();
} }
if (canDelete(sentMessage)) if (canDelete(sentMessage))
sentMessage.delete(); RequestBuffer.request(() -> sentMessage.delete());
} }
/** /**
@ -45,7 +46,7 @@ public class DisappearingMessage extends Thread implements Runnable {
e.printStackTrace(); e.printStackTrace();
} }
if (canDelete(message)) if (canDelete(message))
message.delete(); RequestBuffer.request(() -> message.delete());
}).start(); }).start();
} }