Search in sources :

Example 1 with LavalinkManager

use of fredboat.audio.player.LavalinkManager in project SkyBot by duncte123.

the class MusicCommand method channelChecks.

/**
 * This performs some checks that we need for the music
 *
 * @param event The current {@link net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent GuildMessageReceivedEvent}
 * @return true if the checks pass
 */
protected boolean channelChecks(GuildMessageReceivedEvent event) {
    LavalinkManager lavalinkManager = getLavalinkManager();
    if (!lavalinkManager.isConnected(event.getGuild())) {
        MessageUtils.sendMsg(event, "I'm not in a voice channel, use `" + PREFIX + "join` to make me join a channel");
        return false;
    }
    if (lavalinkManager.getConnectedChannel(event.getGuild()) != null && !lavalinkManager.getConnectedChannel(event.getGuild()).getMembers().contains(event.getMember())) {
        MessageUtils.sendMsg(event, "I'm sorry, but you have to be in the same channel as me to use any music related commands");
        return false;
    }
    getMusicManager(event.getGuild()).latestChannel = event.getChannel();
    return true;
}
Also used : LavalinkManager(fredboat.audio.player.LavalinkManager)

Aggregations

LavalinkManager (fredboat.audio.player.LavalinkManager)1