Listening events

Handling events

You can the @On() decorator to declare methods that will be executed whenever a event is triggered. It's that simple, when the event is triggered, the method is called:

1@On('connection.update')
2onConnectionUpdate({ qr }: Partial<ConnectionState>) {
3  // Do something with qr
4}

Events

Calls

1@On('call')
2async autoReject() {
3 await this.sock.rejectCall()
4}