Skip to content

Commit 6cfa7b4

Browse files
author
linyuan.yang
committed
合并 onTriggerChannelAction
1 parent e1bf1e3 commit 6cfa7b4

3 files changed

Lines changed: 4 additions & 9 deletions

File tree

packages/sbot/src/Channel/ChannelManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export class ChannelManager {
146146
onReceiveMessage: (session, query, args) =>
147147
sessionManager.onReceiveChannelMessage(channelThreadId(plugin.type, channelId, session.sessionId), query, { ...args, channelType: plugin.type, channelId, dbSessionId: session.dbSessionId }),
148148
onTriggerAction: (session, args) =>
149-
sessionManager.onChannelTriggerAction(channelThreadId(plugin.type, channelId, session.sessionId), { ...args, channelType: plugin.type, channelId }),
149+
sessionManager.onTriggerChannelAction(channelThreadId(plugin.type, channelId, session.sessionId), { ...args, channelType: plugin.type, channelId }),
150150
};
151151
const service = await plugin.init(ctx);
152152
if (service) {

packages/sbot/src/Server/HttpServer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ class HttpServer {
524524
case WsCommandType.Approval:
525525
case WsCommandType.Ask:
526526
case WsCommandType.Abort: {
527-
sessionManager.onWebTriggerAction(threadId, msg.type!, msg).catch(e => logger.error(`ws trigger error: ${e?.message ?? e}`));
527+
sessionManager.onTriggerChannelAction(threadId, msg.type!, msg).catch(e => logger.error(`ws trigger error: ${e?.message ?? e}`));
528528
break;
529529
}
530530
}

packages/sbot/src/Session/SessionManager.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,9 @@ export class SbotSessionManager extends SessionManager {
254254

255255
// ── Trigger action routing ──
256256

257-
async onChannelTriggerAction(threadId: string, args: any): Promise<void> {
257+
async onTriggerChannelAction(threadId: string, ...args: any[]): Promise<void> {
258258
const session = this.getSession(threadId) as SbotSession | undefined;
259-
await session?.triggerAction(args);
260-
}
261-
262-
async onWebTriggerAction(threadId: string, type: string, msg: Record<string, any>): Promise<void> {
263-
const session = this.getSession(threadId) as SbotSession | undefined;
264-
await session?.triggerAction(type, msg);
259+
await session?.triggerAction(...args);
265260
}
266261
}
267262

0 commit comments

Comments
 (0)