File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ export interface Events {
95
95
data : ( data : ChatResponse , mc : Masterchat ) => void ;
96
96
actions : ( actions : Action [ ] , mc : Masterchat ) => void ;
97
97
chats : ( chats : AddChatItemAction [ ] , mc : Masterchat ) => void ;
98
+ chat : ( chat : AddChatItemAction , mc : Masterchat ) => void ;
98
99
end : ( reason : EndReason ) => void ;
99
100
error : ( error : MasterchatError | Error ) => void ;
100
101
}
@@ -505,12 +506,13 @@ export class Masterchat extends EventEmitter {
505
506
this . emit ( "actions" , actions , this ) ;
506
507
507
508
// only normal chats
508
- if ( this . listenerCount ( "chats" ) > 0 ) {
509
+ if ( this . listenerCount ( "chats" ) > 0 || this . listenerCount ( "chat" ) > 0 ) {
509
510
const chats = actions . filter (
510
511
( action ) : action is AddChatItemAction =>
511
512
action . type === "addChatItemAction"
512
513
) ;
513
514
this . emit ( "chats" , chats , this ) ;
515
+ chats . forEach ( ( chat ) => this . emit ( "chat" , chat , this ) ) ;
514
516
}
515
517
}
516
518
} ;
You can’t perform that action at this time.
0 commit comments