Skip to content

Events

event #

event(
    callback: CallbackT[EventT] | None = None,
    /,
    *,
    event_type: type[EventT] | None = None,
) -> (
    Callable[
        [CallbackT[EventT]], Includable[EventMeta[EventT]]
    ]
    | Includable[EventMeta[EventT]]
)

Listen to an event. This function should be used instead of hikari.GatewayBot.listen whenever possible.

Example#
import crescent

client = crescent.Client(...)

# Listen to the message create event
@client.include
@crescent.event
async def ping(event: hikari.MessageCreateEvent):
    ...

Event types can be provided using the event_type kwarg if you do not want to use type annotations.