diff --git a/src/wechaty.ts b/src/wechaty.ts index cd248f65273b8bb0641a808daccee6e23481c99b..d21865dd88be11d8c418ac2656d616a207597b2c 100644 --- a/src/wechaty.ts +++ b/src/wechaty.ts @@ -47,6 +47,7 @@ import { CHAT_EVENT_DICT, PUPPET_EVENT_DICT, PuppetEventName, + RoomInvitation } from 'wechaty-puppet' import { @@ -290,6 +291,7 @@ export class Wechaty extends Accessory implements Sayable { public emit(event: 'logout' , user: ContactSelf) : boolean public emit(event: 'login' , user: ContactSelf) : boolean public emit(event: 'message' , message: Message) : boolean + public emit(event: 'room-invite', roomInvitation: RoomInvitation) : boolean public emit(event: 'room-join' , room: Room, inviteeList : Contact[], inviter : Contact) : boolean public emit(event: 'room-leave' , room: Room, leaverList : Contact[], remover? : Contact) : boolean public emit(event: 'room-topic' , room: Room, newTopic: string, oldTopic: string, changer: Contact) : boolean @@ -314,6 +316,7 @@ export class Wechaty extends Accessory implements Sayable { public on(event: 'logout' , listener: string | ((this: Wechaty, user: ContactSelf) => void)) : this public on(event: 'login' , listener: string | ((this: Wechaty, user: ContactSelf) => void)) : this public on(event: 'message' , listener: string | ((this: Wechaty, message: Message) => void)) : this + public on(event: 'room-invite', listener: string | ((this: Wechaty, roomInvitation: RoomInvitation) => void)) : this public on(event: 'room-join' , listener: string | ((this: Wechaty, room: Room, inviteeList: Contact[], inviter: Contact) => void)) : this public on(event: 'room-leave' , listener: string | ((this: Wechaty, room: Room, leaverList: Contact[], remover?: Contact) => void)) : this public on(event: 'room-topic' , listener: string | ((this: Wechaty, room: Room, newTopic: string, oldTopic: string, changer: Contact) => void)) : this @@ -762,6 +765,13 @@ export class Wechaty extends Accessory implements Sayable { }) break + case 'room-invite': + puppet.removeAllListeners('room-invite') + puppet.on('room-invite', async (roomInvitation) => { + this.emit('room-invite', roomInvitation) + }) + break + case 'scan': puppet.removeAllListeners('scan') puppet.on('scan', async (qrcode, status, data) => {