=Work on Music command

This commit is contained in:
Alex
2019-10-18 00:36:20 -04:00
parent 343308c433
commit bbbb138f5e
11 changed files with 249 additions and 43 deletions
+39
View File
@@ -0,0 +1,39 @@
package utils.audio;
import net.dv8tion.jda.core.entities.Guild;
import net.dv8tion.jda.core.entities.VoiceChannel;
import net.dv8tion.jda.core.managers.AudioManager;
public class AudioUtils
{
private Guild guild;
public AudioManager audio;
public AudioUtils(Guild guild)
{
this.guild = guild;
audio = guild.getAudioManager();
}
public boolean joinChannel(String channelName)
{
VoiceChannel channel = null;
channel = guild.getVoiceChannelsByName(channelName, true).get(0);
if(channel != null)
{
audio.openAudioConnection(channel);
return true;
}
return false;
}
public boolean leaveChannel()
{
if(audio.isConnected())
{
audio.closeAudioConnection();
return true;
}
return false;
}
}