use of io.discloader.discloader.entity.voice.VoiceEventAdapter in project DiscLoader by R3alCl0ud.
the class Main method testVoiceThings.
public static CompletableFuture<Void> testVoiceThings(IGuild guild, IChannelCategory category) {
CompletableFuture<Void> future = new CompletableFuture<>();
CompletableFuture<IGuildVoiceChannel> f13 = category.createVoiceChannel("voice-channel");
f13.exceptionally(ex -> {
logger.severe("Test Failed");
ex.printStackTrace();
System.exit(13);
return null;
});
f13.thenAcceptAsync(voicechannel -> {
AvoidRateLimits();
CompletableFuture<VoiceConnection> f14 = voicechannel.join();
f14.exceptionally(ex -> {
logger.severe("Test Failed");
ex.printStackTrace();
System.exit(14);
return null;
});
f14.thenAcceptAsync(voiceconnection -> {
voiceconnection.addListener(new VoiceEventAdapter() {
@Override
public void end(AudioTrack track, AudioTrackEndReason endReason) {
logger.info("Track Finished Playing");
if (endReason == AudioTrackEndReason.LOAD_FAILED) {
logger.severe("Test Failed\nFailed to load the audio track.");
System.exit(15);
return;
}
CompletableFuture<VoiceConnection> f16 = voiceconnection.disconnect();
f16.exceptionally(ex -> {
logger.severe("Test Failed");
ex.printStackTrace();
System.exit(16);
return null;
});
f16.thenAcceptAsync(vc -> {
logger.config("Disconnected From VC");
future.complete(null);
});
}
});
voiceconnection.play("./audio_test.wav");
});
});
return future;
}
use of io.discloader.discloader.entity.voice.VoiceEventAdapter 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