diff --git a/src/main/java/com/bbn/hadder/commands/music/InfoCommand.java b/src/main/java/com/bbn/hadder/commands/music/InfoCommand.java index 2fa069b..cf83fc7 100644 --- a/src/main/java/com/bbn/hadder/commands/music/InfoCommand.java +++ b/src/main/java/com/bbn/hadder/commands/music/InfoCommand.java @@ -11,19 +11,16 @@ import com.sedmelluq.discord.lavaplayer.track.AudioTrack; public class InfoCommand implements Command { - private static final String CD = "\uD83D\uDCBF"; - private static final String MIC = "\uD83C\uDFA4"; - private static final String QUEUE_DESCRIPTION = "%s **|>** %s\n%s\n%s %s\n%s"; - @Override public void executed(String[] args, CommandEvent event) { - if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() == null) { + if (event.getAudioManager().hasPlayer(event.getGuild()) && event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack() != null) { AudioTrack track = event.getAudioManager().getPlayer(event.getGuild()).getPlayingTrack(); - event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, "", "", "", "").build()).queue(); - event.getTextChannel().sendMessage("Track Info" + String.format(QUEUE_DESCRIPTION, CD, event.getAudioManager().getOrNull(track.getInfo().title), - "\n\u23F1 **|>** `[ " + event.getAudioManager().getTimestamp(track.getPosition()) + " / " + event.getAudioManager().getTimestamp(track.getInfo().length) + " ]`", - "\n" + MIC, event.getAudioManager().getOrNull(track.getInfo().author), - "\n\uD83C\uDFA7 **|>** " + "")).queue(); + event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.INFO, + "commands.music.info.success.title", "") + .setAuthor(track.getInfo().author) + .addField("Title", track.getInfo().title, true) + .addField("Progress", "`[ " + event.getAudioManager().getTimestamp(track.getPosition()) + " / " + event.getAudioManager().getTimestamp(track.getInfo().length) + " ]`", false) + .build()).queue(); } else { event.getTextChannel().sendMessage(event.getMessageEditor().getMessage(MessageEditor.MessageType.ERROR, "commands.music.info.error.title", @@ -38,7 +35,7 @@ public class InfoCommand implements Command { @Override public String description() { - return "Shows information about the playing song"; + return "commands.music.info.help.description"; } @Override diff --git a/src/main/java/com/bbn/hadder/commands/owner/EvalCommand.java b/src/main/java/com/bbn/hadder/commands/owner/EvalCommand.java index b8098a2..b05c5f1 100644 --- a/src/main/java/com/bbn/hadder/commands/owner/EvalCommand.java +++ b/src/main/java/com/bbn/hadder/commands/owner/EvalCommand.java @@ -44,7 +44,7 @@ public class EvalCommand implements Command { engine.put("author", event.getAuthor()); engine.put("member", event.getMember()); engine.put("self", event.getGuild().getSelfMember()); - engine.put("audio", new AudioManager()); + engine.put("audio", event.getAudioManager()); engine.put("out", System.out); ScheduledExecutorService service = Executors.newScheduledThreadPool(1); @@ -55,12 +55,12 @@ public class EvalCommand implements Command { Object out; try { - String script = ""; + StringBuilder script = new StringBuilder(); for (int i = 0; i < args.length; i++) { args[i] = args[i].replace("```java", "").replace("```", ""); - script += i == args.length - 1 ? args[i] : args[i] + " "; + script.append(i == args.length - 1 ? args[i] : args[i] + " "); } - out = engine.eval(script); + out = engine.eval(script.toString()); event.getTextChannel().sendMessage(event.getMessageEditor() .getMessage(MessageEditor.MessageType.INFO, "commands.owner.eval.success.title", "") diff --git a/src/main/resources/Translations/Translations_en.properties b/src/main/resources/Translations/Translations_en.properties index 2da7c59..3878e21 100644 --- a/src/main/resources/Translations/Translations_en.properties +++ b/src/main/resources/Translations/Translations_en.properties @@ -203,8 +203,10 @@ commands.music.play.success.length = Length commands.music.play.help.description = Plays a song commands.music.stop.success.title = Successfully stopped commands.music.stop.success.description = I successfully stopped the song. +commands.music.info.success.title = Track info commands.music.info.error.title = No playing track commands.music.info.error.description = I am not playing anything at the moment +commands.music.info.help.description = Shows information about the playing song commands.music.stop.help.description = Stops the song commands.music.queue.error.title = No queue commands.music.queue.error.description = There are no queued songs at the moment