use of io.discloader.discloader.entity.voice.VoiceConnection in project DiscLoader by R3alCl0ud.
the class Main method runVoiceChannelTest.
public static void runVoiceChannelTest() throws Exception {
CompletableFuture<VoiceConnection> future = new CompletableFuture<>();
IGuildVoiceChannel channel = guild.getVoiceChannelByName("General");
VoiceConnection voiceconnection = channel.join().get();
voiceconnection.addListener(new VoiceEventAdapter() {
@Override
public void end(AudioTrack track, AudioTrackEndReason endReason) {
if (endReason == AudioTrackEndReason.LOAD_FAILED) {
logger.severe("Test Failed\nFailed to load the audio track.");
} else {
logger.info("Track Finished Playing");
}
CompletableFuture<VoiceConnection> f16 = voiceconnection.disconnect();
f16.exceptionally(ex -> {
future.completeExceptionally(ex);
return null;
});
f16.thenAcceptAsync(vc -> {
logger.config("Disconnected From VC");
future.complete(vc);
});
}
});
voiceconnection.play("https://soundcloud.com/r3alcl0ud/guardians-of-animus");
future.get();
}
Aggregations