feat(csm): bootstrap discussion callback flow
This commit is contained in:
@@ -18,6 +18,9 @@ type MessageReceivedDeps = {
|
||||
recordChannelAccount: (api: OpenClawPluginApi, channelId: string, accountId: string) => boolean;
|
||||
extractMentionedUserIds: (content: string) => string[];
|
||||
buildUserIdToAccountIdMap: (api: OpenClawPluginApi) => Map<string, string>;
|
||||
discussionService?: {
|
||||
maybeReplyClosedChannel: (channelId: string, senderId?: string) => Promise<boolean>;
|
||||
};
|
||||
};
|
||||
|
||||
export function registerMessageReceivedHook(deps: MessageReceivedDeps): void {
|
||||
@@ -31,6 +34,7 @@ export function registerMessageReceivedHook(deps: MessageReceivedDeps): void {
|
||||
recordChannelAccount,
|
||||
extractMentionedUserIds,
|
||||
buildUserIdToAccountIdMap,
|
||||
discussionService,
|
||||
} = deps;
|
||||
|
||||
api.on("message_received", async (event, ctx) => {
|
||||
@@ -51,6 +55,11 @@ export function registerMessageReceivedHook(deps: MessageReceivedDeps): void {
|
||||
(typeof (e as Record<string, unknown>).from === "string" ? ((e as Record<string, unknown>).from as string) : "");
|
||||
|
||||
const moderatorUserId = getModeratorUserId(livePre);
|
||||
if (discussionService) {
|
||||
const closedHandled = await discussionService.maybeReplyClosedChannel(preChannelId, from);
|
||||
if (closedHandled) return;
|
||||
}
|
||||
|
||||
if (moderatorUserId && from === moderatorUserId) {
|
||||
if (shouldDebugLog(livePre, preChannelId)) {
|
||||
api.logger.info(`dirigent: ignoring moderator message in channel=${preChannelId}`);
|
||||
|
||||
Reference in New Issue
Block a user