ChannelMessageEvent
Description
The ChannelMessageEvent is triggered for every normal message in irc.
Note: /me
messages fire a separate event, ChannelMessageActionEvent
.
You can listen to AbstractChannelMessageEvent
if you want a single event handler that receives both types of messages.
Dependencies
Requires the TwitchChat Module to be enabled and active for the source channel. See TwitchChat.
Examples
Write Chat to Console
- Java
- Kotlin
- Groovy
eventManager.onEvent(ChannelMessageEvent.class, event -> {
System.out.println("[" + event.getChannel().getName() + "] " + event.getUser().getName() + ": " + event.getMessage());
});
eventManager.onEvent(ChannelMessageEvent::class.java) { event ->
println("[${event.channel.name}] ${event.user.name}: ${event.message}")
}
eventManager.onEvent(ChannelMessageEvent) { event ->
System.out.println "[${event.channel.name}] ${event.user.name}: ${event.message}"
}