Search in sources :

Example 1 with TrackScheduler

use of net.kodehawa.mantarobot.commands.music.TrackScheduler in project MantaroBot by Mantaro.

the class MusicCmds method forceskip.

@Command
public static void forceskip(CommandRegistry cr) {
    cr.register("forceskip", new SimpleCommand(Category.MUSIC, CommandPermission.ADMIN) {

        @Override
        protected void call(GuildMessageReceivedEvent event, String content, String[] args) {
            if (!event.getMember().getVoiceState().inVoiceChannel() || !event.getMember().getVoiceState().getChannel().equals(event.getGuild().getAudioManager().getConnectedChannel())) {
                event.getChannel().sendMessage(EmoteReference.ERROR + "You aren't connected to the voice channel I'm in!").queue();
                return;
            }
            TrackScheduler scheduler = MantaroBot.getInstance().getAudioManager().getMusicManager(event.getGuild()).getTrackScheduler();
            event.getChannel().sendMessage(EmoteReference.CORRECT + "An admin decided to skip the current song.").queue();
            scheduler.next(true);
        }

        @Override
        public MessageEmbed help(GuildMessageReceivedEvent event) {
            return helpEmbed(event, "Force skip").setDescription("Well, administrators should be able to forceskip, shouldn't they?").build();
        }
    });
    cr.registerAlias("forceskip", "fs");
}
Also used : SimpleCommand(net.kodehawa.mantarobot.modules.commands.SimpleCommand) GuildMessageReceivedEvent(net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent) TrackScheduler(net.kodehawa.mantarobot.commands.music.TrackScheduler) SimpleCommand(net.kodehawa.mantarobot.modules.commands.SimpleCommand) Command(net.kodehawa.mantarobot.modules.Command)

Aggregations

GuildMessageReceivedEvent (net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent)1 TrackScheduler (net.kodehawa.mantarobot.commands.music.TrackScheduler)1 Command (net.kodehawa.mantarobot.modules.Command)1 SimpleCommand (net.kodehawa.mantarobot.modules.commands.SimpleCommand)1