Skip to content

Commit

Permalink
Always self-deafen
Browse files Browse the repository at this point in the history
  • Loading branch information
MichailiK committed Mar 2, 2024
1 parent bb53bad commit 809a0a6
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/main/java/com/jagrosh/jmusicbot/commands/MusicCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@
*
* @author John Grosh <john.a.grosh@gmail.com>
*/
public abstract class MusicCommand extends Command
public abstract class MusicCommand extends Command
{
protected final Bot bot;
protected boolean bePlaying;
protected boolean beListening;

public MusicCommand(Bot bot)
{
this.bot = bot;
this.guildOnly = true;
this.category = new Category("Music");
}

@Override
protected void execute(CommandEvent event)
protected void execute(CommandEvent event)
{
Settings settings = event.getClient().getSettingsFor(event.getGuild());
TextChannel tchannel = settings.getTextChannel(event.getGuild());
if(tchannel!=null && !event.getTextChannel().equals(tchannel))
{
try
try
{
event.getMessage().delete().queue();
} catch(PermissionException ignore){}
Expand Down Expand Up @@ -83,20 +83,21 @@ protected void execute(CommandEvent event)

if(!event.getGuild().getSelfMember().getVoiceState().inVoiceChannel())
{
try
try
{
event.getGuild().getAudioManager().openAudioConnection(userState.getChannel());
event.getGuild().getAudioManager().setSelfDeafened(true);
}
catch(PermissionException ex)
catch(PermissionException ex)
{
event.reply(event.getClient().getError()+" I am unable to connect to "+userState.getChannel().getAsMention()+"!");
return;
}
}
}

doCommand(event);
}

public abstract void doCommand(CommandEvent event);
}

0 comments on commit 809a0a6

Please sign in to comment.