User sent message
This function is triggered when a user sends a new message. Inside this function you can define custom logic to handle what happens when any user sends a message.
async function handleEvent(event: UserSentMessageEvent, context: Context) {
}
The above function takes two parameters:
-
The event object which in this case is the
UserSentMessageEventobject. This object has two properties:user: The user who sent the message.channel: The channel this message was sent.message: The message sent by this user.
-
A
Contextobject.
note
This is a non-blocking chat function.