use of io.github.brendonmiranda.bot.clancy.listener.AudioEventListener in project clancy by brendonmiranda.
the class PlayCmd method command.
@Override
public void command(SlashCommandEvent event) {
OptionMapping option = event.getOption(MUSIC_ARG);
String args = option.getAsString();
logger.debug("PlayCmd loading track: {}", args);
AudioPlayer audioPlayer = audioPlayerManager.createPlayer();
audioPlayer.addListener(audioEventListener);
Consumer<Message> success = (message) -> {
Guild guild = event.getGuild();
AudioManager audioManager = guild.getAudioManager();
PlayResultHandler playResultHandler = new PlayResultHandler(audioPlayer, guild, audioManager, event, audioPlayerManager, eventWaiter, message, false, audioQueueService);
audioPlayerManager.loadItemOrdered(event.getGuild(), args, playResultHandler);
};
event.replyEmbeds(MessageUtil.buildMessage("Searching...")).queue(interactionHook -> {
interactionHook.retrieveOriginal().queue(success);
});
}
Aggregations