on

inline fun <T : Event> on(launch: Boolean = true, scope: CoroutineScope = kordRef, noinline consumer: suspend T.() -> Unit): Job

Subscribe to an event. You shouldn't need to use this directly, but it's here just in case.

You can subscribe to any type, realistically - but this is intended to be used only with Kord Event subclasses, and our own KordExEvents.

Parameters

T

Types of event to subscribe to.

scope

Coroutine scope to run the body of your callback under.

consumer

The callback to run when the event is fired.