Skip to content

Commit

Permalink
Set Handler before connect.
Browse files Browse the repository at this point in the history
  • Loading branch information
DxsSucuk committed Mar 26, 2024
1 parent 322f98a commit b9b3646
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/de/presti/ree6/commands/impl/fun/Record.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ public void connectAndRecord(CommandEvent commandEvent) {
AudioChannelUnion audioChannelUnion = voiceState.getChannel();

AudioManager audioManager = commandEvent.getGuild().getAudioManager();
audioManager.openAudioConnection(audioChannelUnion);

AudioPlayerReceiveHandler handler = new AudioPlayerReceiveHandler(commandEvent.getMember(), audioChannelUnion);

audioManager.setReceivingHandler(handler);

audioManager.openAudioConnection(audioChannelUnion);

if (commandEvent.getGuild().getSelfMember().getVoiceState() != null &&
commandEvent.getGuild().getSelfMember().getVoiceState().inAudioChannel()) {
commandEvent.getGuild().getSelfMember().deafen(false).queue();
Expand Down

0 comments on commit b9b3646

Please sign in to comment.