Info Command
This commit is contained in:
parent
bf5d3c8364
commit
8d19b9ae07
3 changed files with 14 additions and 15 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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", "")
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue