use of com.sedmelluq.discord.lavaplayer.source.soundcloud.SoundCloudAudioTrack 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"));
}
}
Aggregations