diff --git a/pom.xml b/pom.xml index 62892b2e6..5fe5508fb 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.jagrosh JMusicBot - 0.6.7-beta.3 + 0.6.7-beta.4 jar diff --git a/src/main/java/dev/cosgy/JMusicBot/slashcommands/music/SearchCmd.java b/src/main/java/dev/cosgy/JMusicBot/slashcommands/music/SearchCmd.java index 3d05269b8..85252e9e6 100644 --- a/src/main/java/dev/cosgy/JMusicBot/slashcommands/music/SearchCmd.java +++ b/src/main/java/dev/cosgy/JMusicBot/slashcommands/music/SearchCmd.java @@ -111,7 +111,7 @@ public void trackLoaded(AudioTrack track) { @Override public void playlistLoaded(AudioPlaylist playlist) { builder.setColor(event.getGuild().getSelfMember().getColor()) - .setText(FormatUtil.filter(client.getSuccess() + " の検索結果 `" + event.getOption("input").getAsString() + "`:")) + .setText(FormatUtil.filter(client.getSuccess() + " `" + event.getOption("input").getAsString() + "`の検索結果:")) .setChoices() .setSelection((msg, i) -> { @@ -153,72 +153,78 @@ public void loadFailed(FriendlyException throwable) { } } - private class ResultHandler implements AudioLoadResultHandler { + private class ResultHandler implements AudioLoadResultHandler + { private final Message m; private final CommandEvent event; - private ResultHandler(Message m, CommandEvent event) { + private ResultHandler(Message m, CommandEvent event) + { this.m = m; this.event = event; } @Override - public void trackLoaded(AudioTrack track) { - if (bot.getConfig().isTooLong(track)) { - m.editMessage(FormatUtil.filter(event.getClient().getWarning() + "**" + track.getInfo().title + "**`は許可されている最大長より長いです。" - + FormatUtil.formatTime(track.getDuration()) + "` > `" + bot.getConfig().getMaxTime() + "`")).queue(); + public void trackLoaded(AudioTrack track) + { + if(bot.getConfig().isTooLong(track)) + { + m.editMessage(FormatUtil.filter(event.getClient().getWarning()+" この曲 (**"+track.getInfo().title+"**) は許可されている最大長よりも長いです。 `" + +FormatUtil.formatTime(track.getDuration())+"` > `"+bot.getConfig().getMaxTime()+"`")).queue(); return; } - AudioHandler handler = (AudioHandler) event.getGuild().getAudioManager().getSendingHandler(); - int pos = handler.addTrack(new QueuedTrack(track, event.getAuthor())) + 1; - m.editMessage(FormatUtil.filter(event.getClient().getSuccess() + "**" + track.getInfo().title - + "**(`" + FormatUtil.formatTime(track.getDuration()) + "`) " + (pos == 0 ? "を追加しました。" + AudioHandler handler = (AudioHandler)event.getGuild().getAudioManager().getSendingHandler(); + int pos = handler.addTrack(new QueuedTrack(track, event.getAuthor()))+1; + m.editMessage(FormatUtil.filter(event.getClient().getSuccess()+" **"+track.getInfo().title + +"** (`"+FormatUtil.formatTime(track.getDuration())+"`) "+(pos==0 ? "の再生を開始します。" : "を" + pos + "番目の再生待ちに追加しました。"))).queue(); } @Override - public void playlistLoaded(AudioPlaylist playlist) { - m.delete().queue(); + public void playlistLoaded(AudioPlaylist playlist) + { builder.setColor(event.getSelfMember().getColor()) - .setText(FormatUtil.filter(event.getClient().getSuccess() + " の検索結果 `" + event.getArgs() + "`:")) - .setChoices() - .setSelection((msg, i) -> + .setText(FormatUtil.filter(event.getClient().getSuccess()+" `"+event.getArgs()+"`の検索結果:")) + .setChoices(new String[0]) + .setSelection((msg,i) -> { - AudioTrack track = playlist.getTracks().get(i - 1); - if (bot.getConfig().isTooLong(track)) { - event.replyWarning("**" + track.getInfo().title + "**`は許可されている最大長よりも長いです。" - + FormatUtil.formatTime(track.getDuration()) + "` > `" + bot.getConfig().getMaxTime() + "`"); + AudioTrack track = playlist.getTracks().get(i-1); + if(bot.getConfig().isTooLong(track)) + { + event.replyWarning("この曲 (**"+track.getInfo().title+"**) は、許容される最大長より長いです。: `" + +FormatUtil.formatTime(track.getDuration())+"` > `"+bot.getConfig().getMaxTime()+"`"); return; } - AudioHandler handler = (AudioHandler) event.getGuild().getAudioManager().getSendingHandler(); - int pos = handler.addTrack(new QueuedTrack(track, event.getAuthor())) + 1; - event.replySuccess("**" + track.getInfo().title - + "**(`" + FormatUtil.formatTime(track.getDuration()) + "`) " + (pos == 0 ? "を追加しました。" - : " を" + pos + "番目の再生待ちに追加しました。 ")); - }) - .setCancel((msg) -> { + AudioHandler handler = (AudioHandler)event.getGuild().getAudioManager().getSendingHandler(); + int pos = handler.addTrack(new QueuedTrack(track, event.getAuthor()))+1; + event.replySuccess("**" + FormatUtil.filter(track.getInfo().title) + + "** (`" + FormatUtil.formatTime(track.getDuration()) + "`) " + (pos==0 ? "の再生を開始します。" + : "を" + pos + "番目の再生待ちに追加しました。")); }) + .setCancel((msg) -> {}) .setUsers(event.getAuthor()) ; - for (int i = 0; i < 4 && i < playlist.getTracks().size(); i++) { + for(int i=0; i<4 && i