Search in sources :

Example 1 with MessageChannel

use of discord4j.core.object.entity.MessageChannel in project lavaplayer by sedmelluq.

the class Main method onMessageReceived.

private void onMessageReceived(MessageCreateEvent event) {
    Message message = event.getMessage();
    message.getContent().ifPresent(it -> {
        MessageChannel channel = message.getChannel().block();
        if (channel instanceof TextChannel) {
            String[] command = it.split(" ", 2);
            if ("~play".equals(command[0]) && command.length == 2) {
                loadAndPlay((TextChannel) channel, command[1]);
            } else if ("~skip".equals(command[0])) {
                skipTrack((TextChannel) channel);
            }
        }
    });
}
Also used : TextChannel(discord4j.core.object.entity.TextChannel) Message(discord4j.core.object.entity.Message) MessageChannel(discord4j.core.object.entity.MessageChannel)

Aggregations

Message (discord4j.core.object.entity.Message)1 MessageChannel (discord4j.core.object.entity.MessageChannel)1 TextChannel (discord4j.core.object.entity.TextChannel)1