PrivateMessageEvent
Description
The PrivateMessageEvent is triggered for private messages / whispers and can be triggered from PubSub or Chat.
Dependencies
Requires the TwitchChat Module to be enabled and active for the source channel. See TwitchChat. Otherwise you will need to enable PubSub and subscribe to the whispers topic the receive PrivateMessageEvents.
Examples
Listen for PrivateMessageEvent
- Java
- Kotlin
- Groovy
eventManager.onEvent(PrivateMessageEvent.class, event -> {
System.out.println("[Whisper] " + event.getUser().getName() + ": " + event.getMessage());
});
eventManager.onEvent(PrivateMessageEvent::class.java) { event ->
println("[Whisper] ${event.user.name}: ${event.message}")
}
eventManager.onEvent(PrivateMessageEvent) { event ->
System.out.println "[Whisper] ${event.user.name}: ${event.message}"
}