+Started music integration

Voice channel join/disconnect
This commit is contained in:
Alex Stewart
2019-07-30 01:19:34 -07:00
parent 9cc703ab63
commit a62c10d06e
11 changed files with 124 additions and 5 deletions
+38
View File
@@ -0,0 +1,38 @@
package utils;
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;
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;
}
}