Browse Source

getVoiceChannelByParam() erweitert, sodass auch der aktuelle Kanal in dem sich der bot befindet berücksichtigt wird.

pull/2/head
yl60lepu 4 years ago
parent
commit
6385ea58d5
1 changed files with 9 additions and 3 deletions
  1. +9
    -3
      app/src/main/java/de/yannicpunktdee/yoshibot/command/YoshiCommand.java

+ 9
- 3
app/src/main/java/de/yannicpunktdee/yoshibot/command/YoshiCommand.java View File

@ -131,12 +131,18 @@ public abstract class YoshiCommand {
if(context.getArgument("channel") == null) return null; if(context.getArgument("channel") == null) return null;
List<VoiceChannel> channels = YoshiBot.getInstance().jda.getVoiceChannelsByName(context.getArgument("channel"), true); List<VoiceChannel> channels = YoshiBot.getInstance().jda.getVoiceChannelsByName(context.getArgument("channel"), true);
if (!(channels.size() > 0)) { if (!(channels.size() > 0)) {
context.getEvent().getTextChannel().sendMessage("Der Kanalname konnte nicht gefunden werden.").queue();
sendErrorMessage("Der Kanalname konnte nicht gefunden werden.");
return null; return null;
} }
vc = channels.get(0); vc = channels.get(0);
}else{
vc = context.getEvent().getMember().getVoiceState().getChannel();
}else {
try{
vc = context.getEvent().getMember().getVoiceState().getChannel();
if(vc == null) vc = YoshiBot.getInstance().getGuild().getAudioManager().getConnectedChannel();
}catch (Exception e){
sendErrorMessage("Es konnte kein Voicekanal gefunden werden in dem die Audio-Datei abgespielt werden kann.");
return null;
}
} }
return vc; return vc;
} }


Loading…
Cancel
Save