Search in sources :

Example 1 with BeamAudioTrack

use of com.sedmelluq.discord.lavaplayer.source.beam.BeamAudioTrack in project FredBoat by Frederikam.

the class NowplayingCommand method onInvoke.

@Override
public void onInvoke(@Nonnull CommandContext context) {
    GuildPlayer player = Launcher.getBotController().getPlayerRegistry().getExisting(context.guild);
    if (player != null && player.isPlaying()) {
        AudioTrackContext atc = player.getPlayingTrack();
        AudioTrack at = atc.getTrack();
        EmbedBuilder builder;
        if (at instanceof YoutubeAudioTrack) {
            builder = getYoutubeEmbed(atc, player, (YoutubeAudioTrack) at);
        } else if (at instanceof SoundCloudAudioTrack) {
            builder = getSoundcloudEmbed(atc, player, (SoundCloudAudioTrack) at);
        } else if (at instanceof HttpAudioTrack && at.getIdentifier().contains("gensokyoradio.net")) {
            // Special handling for GR
            builder = getGensokyoRadioEmbed(context);
        } else if (at instanceof HttpAudioTrack) {
            builder = getHttpEmbed(atc, player, (HttpAudioTrack) at);
        } else if (at instanceof BandcampAudioTrack) {
            builder = getBandcampResponse(atc, player, (BandcampAudioTrack) at);
        } else if (at instanceof TwitchStreamAudioTrack) {
            builder = getTwitchEmbed(atc, (TwitchStreamAudioTrack) at);
        } else if (at instanceof BeamAudioTrack) {
            builder = getBeamEmbed(atc, (BeamAudioTrack) at);
        } else {
            builder = getDefaultEmbed(atc, player, at);
        }
        Member requester = atc.getMember() != null ? atc.getMember() : context.guild.getSelfMember();
        builder = CentralMessaging.addNpFooter(builder, requester);
        context.reply(builder.build());
    } else {
        context.reply(context.i18n("npNotPlaying"));
    }
}
Also used : TwitchStreamAudioTrack(com.sedmelluq.discord.lavaplayer.source.twitch.TwitchStreamAudioTrack) HttpAudioTrack(com.sedmelluq.discord.lavaplayer.source.http.HttpAudioTrack) EmbedBuilder(net.dv8tion.jda.core.EmbedBuilder) GuildPlayer(fredboat.audio.player.GuildPlayer) AudioTrackContext(fredboat.audio.queue.AudioTrackContext) YoutubeAudioTrack(com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack) HttpAudioTrack(com.sedmelluq.discord.lavaplayer.source.http.HttpAudioTrack) BeamAudioTrack(com.sedmelluq.discord.lavaplayer.source.beam.BeamAudioTrack) YoutubeAudioTrack(com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack) SoundCloudAudioTrack(com.sedmelluq.discord.lavaplayer.source.soundcloud.SoundCloudAudioTrack) AudioTrack(com.sedmelluq.discord.lavaplayer.track.AudioTrack) BandcampAudioTrack(com.sedmelluq.discord.lavaplayer.source.bandcamp.BandcampAudioTrack) TwitchStreamAudioTrack(com.sedmelluq.discord.lavaplayer.source.twitch.TwitchStreamAudioTrack) BeamAudioTrack(com.sedmelluq.discord.lavaplayer.source.beam.BeamAudioTrack) SoundCloudAudioTrack(com.sedmelluq.discord.lavaplayer.source.soundcloud.SoundCloudAudioTrack) BandcampAudioTrack(com.sedmelluq.discord.lavaplayer.source.bandcamp.BandcampAudioTrack) Member(net.dv8tion.jda.core.entities.Member)

Aggregations

BandcampAudioTrack (com.sedmelluq.discord.lavaplayer.source.bandcamp.BandcampAudioTrack)1 BeamAudioTrack (com.sedmelluq.discord.lavaplayer.source.beam.BeamAudioTrack)1 HttpAudioTrack (com.sedmelluq.discord.lavaplayer.source.http.HttpAudioTrack)1 SoundCloudAudioTrack (com.sedmelluq.discord.lavaplayer.source.soundcloud.SoundCloudAudioTrack)1 TwitchStreamAudioTrack (com.sedmelluq.discord.lavaplayer.source.twitch.TwitchStreamAudioTrack)1 YoutubeAudioTrack (com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack)1 AudioTrack (com.sedmelluq.discord.lavaplayer.track.AudioTrack)1 GuildPlayer (fredboat.audio.player.GuildPlayer)1 AudioTrackContext (fredboat.audio.queue.AudioTrackContext)1 EmbedBuilder (net.dv8tion.jda.core.EmbedBuilder)1 Member (net.dv8tion.jda.core.entities.Member)1