import { MessageHandler } from '@wireapp/bot-api' ; import { PayloadBundle , PayloadBundleType } from '@wireapp/core/src/main/conversation/' ; import type { Connection } from '@wireapp/api-client/src/connection' ; export class AutoConnectHandler extends MessageHandler { async handleEvent ( payload ) { switch ( payload . type ) { case PayloadBundleType . CONNECTION_REQUEST : const content = payload . content as Connection ; try { await this . sendConnectionResponse ( content . to , true ) ; } catch ( error ) { console . warn ( `Failed to accept connection request from "${ payload . from }": ${ ( error as Error ) . message }` , error ) ; } break ; } } }