Search in sources :

Example 1 with GuildMusicManager

use of Core.Music.GuildMusicManager in project Wylx by Wylx-Bot.

the class VoiceChannelProcessing method checkVoiceChannel.

private void checkVoiceChannel(long guildID) {
    GuildMusicManager guildMusicManager = WylxPlayerManager.getInstance().getGuildManager(guildID);
    AudioManager manager = Wylx.getInstance().getGuildAudioManager(guildID);
    AudioChannel channel = manager.getConnectedChannel();
    if (channel == null) {
        guildMusicManager.stop();
        return;
    }
    // Leave if we are the only user left
    if (manager.isConnected() && channel.getMembers().size() == 1) {
        logger.debug("Leaving {} due to inactivity", guildID);
        guildMusicManager.stop();
    }
}
Also used : AudioManager(net.dv8tion.jda.api.managers.AudioManager) GuildMusicManager(Core.Music.GuildMusicManager) AudioChannel(net.dv8tion.jda.api.entities.AudioChannel)

Aggregations

GuildMusicManager (Core.Music.GuildMusicManager)1 AudioChannel (net.dv8tion.jda.api.entities.AudioChannel)1 AudioManager (net.dv8tion.jda.api.managers.AudioManager)1