BEventListener

@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class BEventListener(val async: Boolean = false, val mode: BEventListener.RunMode = RunMode.SHARED, val priority: Int = 0, val ignoreIntents: Boolean = false, val ignoredIntents: Array<GatewayIntent> = [], val timeout: Long = 0, val timeoutUnit: TimeUnit = TimeUnit.SECONDS)(source)

Annotates a function as an event listener for a JDA or BC event.

Remember to always check the requirements of the events you're listening to!

Requirements

  • The declaring class must be a service

  • The function must not be static

  • The first argument must be a subclass of GenericEvent or BGenericEvent

Types

Link copied to clipboard

Represents how the event listener will run

Properties

Link copied to clipboard
val async: Boolean = false

Whether this event listener is executed on its own coroutine, using the event dispatcher scope

Link copied to clipboard

Intents which should not be required for this event listener.

Link copied to clipboard
val ignoreIntents: Boolean = false

Whether this event listener should be kept enabled, even if it is missing intents.

Link copied to clipboard

How this event listener should run, see RunMode values.

Link copied to clipboard
val priority: Int = 0

The priority for this event listener

Link copied to clipboard
val timeout: Long = 0

The time before the coroutine is canceled, using a negative value means no timeout.

Link copied to clipboard

The time unit used for the timeout