Skip to content

Commit

Permalink
fix(core): fix missing internal events, close #175
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Nov 3, 2023
1 parent 75b06e7 commit 87df9fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion adapters/kook/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export function adaptSession<C extends Context>(bot: Bot<C>, input: any) {
bot.dispatch(bot.session({
type: 'internal',
_type: 'kook/' + type.replace(/_/g, '-'),
_data: input.body,
_data: body,
}))
switch (type) {
case 'updated_message':
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ export abstract class Bot<C extends Context = Context, T = any> implements Login
}
}
this.context.emit('internal/session', session)
if (session.type === 'internal') return
if (session.type === 'internal') {
this.context.emit(session.event._type, session.event._data)
return
}
for (const event of events) {
this.context.emit(session, event as any, session)
}
Expand Down

0 comments on commit 87df9fb

Please sign in to comment.