on

inline fun <T : Event> Kord.on(scope: CoroutineScope = this, noinline consumer: suspend T.() -> Unit): Job(source)

Convenience method that will invoke the consumer on every event T created by Kord.events.

The events are buffered in an unlimited buffer and launched in the supplied scope, which is Kord by default. Each event will be launched inside the scope separately and any thrown Throwable will be caught and logged.

The returned Job is a reference to the created coroutine, call Job.cancel to cancel the processing of any further events for this consumer.