Skip to content

Commit

Permalink
Botだけになったら自動で抜ける
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamesuta committed Jul 16, 2024
1 parent c064ac6 commit 026cfb5
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public void onGuildVoiceUpdate(@NotNull GuildVoiceUpdateEvent event) {
if (join != null) {
getTTSManager().connect(event.getGuild(), join);
}
} else if (left != null) {
// 誰かが抜けて、BotだけになったらVCから切断
boolean isAlone = left.getMembers().stream().allMatch(n -> n.getUser().isBot());
if (isAlone) {
left.getGuild().getAudioManager().closeAudioConnection();
}
}

getTTSManager().onVCEvent(event.getGuild(), event.getMember(), join, left);
Expand Down

0 comments on commit 026cfb5

Please sign in to comment.