Skip to content
This repository has been archived by the owner on Jul 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #213 from book000/fix/skip-moved-check-message
Browse files Browse the repository at this point in the history
fix: 移動検知をしない場合に、「移動先を探しています…」が残る問題修正
  • Loading branch information
yuuahp authored May 21, 2023
2 parents a78e6d5 + 8d8ecbb commit b1be116
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@ public void onGuildVoiceUpdate(@NotNull GuildVoiceUpdateEvent event) {
AudioChannel channel = event.getChannelLeft();
if (MultipleServer.getVCChannel(event.getGuild()) == null) return;

// 別鯖への移動検知をするかどうかのフラグ
boolean isCheckWhereMoved = !user.isBot();

String defaultContent = ":outbox_tray: `%s` が <#%s> から退出しました。".formatted(
user.getName(),
channel.getId());
String content = isCheckWhereMoved ? defaultContent + "移動先を探しています…。" : defaultContent;
Message message = MultipleServer
.getVCChannel(event.getGuild())
.sendMessage("%s移動先を探しています…。".formatted(defaultContent))
.sendMessage(content)
.complete();

// VCに残ったユーザーが全員Bot、または誰もいなくなった
Expand All @@ -71,7 +75,7 @@ public void onGuildVoiceUpdate(@NotNull GuildVoiceUpdateEvent event) {
);
}

if (user.isBot()) {
if (!isCheckWhereMoved) {
return; // Botは別鯖の移動検知をしない
}

Expand Down

0 comments on commit b1be116

Please sign in to comment.