From 9263210db10f6c7b6a9bda80031e661a9f4490ca Mon Sep 17 00:00:00 2001 From: kosugikun <33971692+kosugikun@users.noreply.github.com> Date: Sun, 14 Apr 2024 21:06:44 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=8B=E3=82=B3=E3=83=8B=E3=82=B3=E5=8B=95?= =?UTF-8?q?=E7=94=BB=E6=A4=9C=E7=B4=A2=E3=81=A7=E6=9B=B2=E3=82=92=E3=83=AA?= =?UTF-8?q?=E3=82=AF=E3=82=A8=E3=82=B9=E3=83=88=E5=BE=8C=E3=80=81=E7=B5=90?= =?UTF-8?q?=E6=9E=9C=E3=81=AE=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=81=8C=E9=80=81=E4=BF=A1=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84?= =?UTF-8?q?=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jmusicbot/slashcommands/music/NicoSearchCmd.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/dev/cosgy/jmusicbot/slashcommands/music/NicoSearchCmd.java b/src/main/java/dev/cosgy/jmusicbot/slashcommands/music/NicoSearchCmd.java index c3f82018f..7156725ca 100644 --- a/src/main/java/dev/cosgy/jmusicbot/slashcommands/music/NicoSearchCmd.java +++ b/src/main/java/dev/cosgy/jmusicbot/slashcommands/music/NicoSearchCmd.java @@ -181,10 +181,12 @@ public void loadFailed(FriendlyException exception) { } private class SlashResultHandler implements AudioLoadResultHandler { + private final InteractionHook m; private final SlashCommandEvent event; private final Bot bot; private SlashResultHandler(InteractionHook m, SlashCommandEvent event, Bot bot) { + this.m = m; this.bot = bot; this.event = event; } @@ -197,7 +199,7 @@ private SlashResultHandler(InteractionHook m, SlashCommandEvent event, Bot bot) @Override public void trackLoaded(AudioTrack track) { if (bot.getConfig().isTooLong(track)) { - event.reply(FormatUtil.filter(event.getClient().getWarning() + " 楽曲 (**" + track.getInfo().title + "**) は許容されている動画の長さを超えています: `" + m.editOriginal(FormatUtil.filter(event.getClient().getWarning() + " 楽曲 (**" + track.getInfo().title + "**) は許容されている動画の長さを超えています: `" + FormatUtil.formatTime(track.getDuration()) + "` > `" + bot.getConfig().getMaxTime() + "`")).queue(); return; } @@ -205,7 +207,7 @@ public void trackLoaded(AudioTrack track) { AudioHandler handler = (AudioHandler) event.getGuild().getAudioManager().getSendingHandler(); int pos = handler.addTrack(new QueuedTrack(track, event.getUser())) + 1; - event.reply(FormatUtil.filter(String.format("%s %s **%s** (`%s`) を追加しました", event.getClient().getSuccess(), (pos == 0 ? "再生待ちに" : "再生待ち #" + pos + " に"), track.getInfo().title, FormatUtil.formatTime(track.getDuration())))).queue(); + m.editOriginal(FormatUtil.filter(String.format("%s %s **%s** (`%s`) を追加しました", event.getClient().getSuccess(), (pos == 0 ? "再生待ちに" : "再生待ち #" + pos + " に"), track.getInfo().title, FormatUtil.formatTime(track.getDuration())))).queue(); } /** @@ -223,7 +225,7 @@ public void playlistLoaded(AudioPlaylist playlist) { */ @Override public void noMatches() { - event.reply(FormatUtil.filter(event.getClient().getWarning() + " `" + event.getOption("input").getAsString() + "`の検索結果はありません.")).queue(); + m.editOriginal(FormatUtil.filter(event.getClient().getWarning() + " `" + event.getOption("input").getAsString() + "`の検索結果はありません.")).queue(); } /** @@ -234,9 +236,9 @@ public void noMatches() { @Override public void loadFailed(FriendlyException exception) { if (exception.severity == FriendlyException.Severity.COMMON) - event.reply(event.getClient().getError() + " 読み込み中にエラーが発生しました: " + exception.getMessage()).queue(); + m.editOriginal(event.getClient().getError() + " 読み込み中にエラーが発生しました: " + exception.getMessage()).queue(); else - event.reply(event.getClient().getError() + " 楽曲を読み込み中にエラーが発生しました").queue(); + m.editOriginal(event.getClient().getError() + " 楽曲を読み込み中にエラーが発生しました").queue(); } } }