use of fredboat.audio.player.GuildPlayer in project FredBoat by Frederikam.
the class RestartCommand method onInvoke.
@Override
public void onInvoke(@Nonnull CommandContext context) {
GuildPlayer player = Launcher.getBotController().getPlayerRegistry().getExisting(context.guild);
if (player != null && !player.isQueueEmpty()) {
if (player.getPlayingTrack() == null) {
player.play();
}
player.seekTo(player.getPlayingTrack().getStartPosition());
context.reply(context.i18nFormat("restartSuccess", TextUtils.escapeAndDefuse(player.getPlayingTrack().getEffectiveTitle())));
} else {
context.replyWithName(context.i18n("queueEmpty"));
}
}
use of fredboat.audio.player.GuildPlayer in project FredBoat by Frederikam.
the class LeaveCommand method onInvoke.
@Override
public void onInvoke(@Nonnull CommandContext context) {
try {
GuildPlayer player = Launcher.getBotController().getPlayerRegistry().getExisting(context.guild);
if (player != null) {
player.pause();
player.leaveVoiceChannelRequest(context, false);
}
} catch (Exception e) {
log.error("Something caused us to not properly leave a voice channel!", e);
Launcher.getBotController().getAudioConnectionFacade().closeConnection(context.guild);
}
}
use of fredboat.audio.player.GuildPlayer in project FredBoat by Frederikam.
the class PlaySplitCommand method onInvoke.
@Override
public void onInvoke(@Nonnull CommandContext context) {
if (!context.hasArguments()) {
HelpCommand.sendFormattedCommandHelp(context);
return;
}
PlayerRegistry playerRegistry = Launcher.getBotController().getPlayerRegistry();
if (!playerLimiter.checkLimitResponsive(context, playerRegistry))
return;
IdentifierContext ic = new IdentifierContext(Launcher.getBotController().getJdaEntityProvider(), context.args[0], context.channel, context.invoker);
ic.setSplit(true);
GuildPlayer player = playerRegistry.getOrCreate(context.guild);
player.queue(ic);
player.setPause(false);
context.deleteMessage();
}
use of fredboat.audio.player.GuildPlayer in project FredBoat by Frederikam.
the class ReshuffleCommand method onInvoke.
@Override
public void onInvoke(@Nonnull CommandContext context) {
GuildPlayer player = Launcher.getBotController().getPlayerRegistry().getExisting(context.guild);
if (player == null || !player.isShuffle()) {
context.replyWithName(context.i18n("reshufflePlayerNotShuffling"));
return;
}
player.reshuffle();
context.reply(context.i18n("reshufflePlaylist"));
}
Aggregations