|
|
|
@ -28,9 +28,9 @@ import net.dv8tion.jda.api.JDA; |
|
|
|
|
import net.dv8tion.jda.api.JDABuilder; |
|
|
|
|
import net.dv8tion.jda.api.entities.*; |
|
|
|
|
import net.dv8tion.jda.api.entities.channel.middleman.AudioChannel; |
|
|
|
|
import net.dv8tion.jda.api.entities.channel.unions.AudioChannelUnion; |
|
|
|
|
import net.dv8tion.jda.api.events.guild.voice.GuildVoiceUpdateEvent; |
|
|
|
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent; |
|
|
|
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent; |
|
|
|
|
import net.dv8tion.jda.api.hooks.ListenerAdapter; |
|
|
|
|
import net.dv8tion.jda.api.managers.AudioManager; |
|
|
|
|
import net.dv8tion.jda.api.requests.GatewayIntent; |
|
|
|
@ -103,6 +103,7 @@ public final class Chords extends ListenerAdapter |
|
|
|
|
builder.setCompression(Compression.NONE); |
|
|
|
|
// Set activity (like "playing Something")
|
|
|
|
|
builder.setActivity(Activity.playing("music!")); |
|
|
|
|
builder.enableIntents(GatewayIntent.MESSAGE_CONTENT); |
|
|
|
|
|
|
|
|
|
final Chords listener = new Chords(); |
|
|
|
|
|
|
|
|
@ -187,13 +188,13 @@ public final class Chords extends ListenerAdapter |
|
|
|
|
if (this.currentVoiceChannel == null) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
final AudioChannelUnion channelLeft = event.getChannelLeft(); |
|
|
|
|
|
|
|
|
|
final AudioChannel channelLeft = event.getChannelLeft(); |
|
|
|
|
if (channelLeft != null && channelLeft == currentVoiceChannel) |
|
|
|
|
{ |
|
|
|
|
if (channelLeft.getMembers().isEmpty()) |
|
|
|
|
if (channelLeft == currentVoiceChannel) |
|
|
|
|
disconnect(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
public void onMessageReceived(MessageReceivedEvent event) |
|
|
|
|
{ |
|
|
|
|