Skip to content

Commit

Permalink
fix(JoinCommand): update import
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaspet committed Jun 24, 2024
1 parent 7531e06 commit f49c62a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/main/java/dev/benpetrillo/elixir/commands/JoinCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@
import dev.benpetrillo.elixir.utilities.EmbedUtil;
import net.dv8tion.jda.api.entities.GuildVoiceState;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel;
import net.dv8tion.jda.api.entities.channel.middleman.AudioChannel;
import net.dv8tion.jda.api.managers.AudioManager;
import tech.xigam.cch.command.Command;
import tech.xigam.cch.utils.Interaction;

import java.util.Objects;

public final class JoinCommand extends Command {

public JoinCommand() {
Expand All @@ -51,12 +49,13 @@ public void execute(Interaction interaction) {
return;
}
final AudioManager audioManager = interaction.getGuild().getAudioManager();
final VoiceChannel memberChannel = Objects.requireNonNull(memberVoiceState.getChannel()).asVoiceChannel();
final AudioChannel audioChannel = memberVoiceState.getChannel();
assert voiceState != null;
assert audioChannel != null;
if (!voiceState.inAudioChannel()) {
audioManager.openAudioConnection(memberChannel);
audioManager.openAudioConnection(audioChannel);
audioManager.setSelfDeafened(true);
String name = memberChannel.getName();
String name = audioChannel.getName();
MessageEmbed embed = EmbedUtil.sendDefaultEmbed(String.format("I've connected to **%s** successfully.", name));
interaction.reply(embed, false);

Expand Down

0 comments on commit f49c62a

Please sign in to comment.