mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-24 15:14:27 +00:00
refactor(discord): compose native command routes
This commit is contained in:
@@ -85,8 +85,7 @@ import {
|
||||
import { buildDiscordNativeCommandContext } from "./native-command-context.js";
|
||||
import { resolveDiscordNativeCommandSessionTargets } from "./native-command-session-targets.js";
|
||||
import {
|
||||
buildDiscordRoutePeer,
|
||||
resolveDiscordConversationRoute,
|
||||
resolveDiscordBoundConversationRoute,
|
||||
resolveDiscordEffectiveRoute,
|
||||
} from "./route-resolution.js";
|
||||
import { resolveDiscordSenderIdentity } from "./sender-identity.js";
|
||||
@@ -451,25 +450,19 @@ async function resolveDiscordModelPickerRoute(params: {
|
||||
threadParentId = parentInfo.id;
|
||||
}
|
||||
|
||||
const route = resolveDiscordConversationRoute({
|
||||
const threadBinding = isThreadChannel
|
||||
? params.threadBindings.getByThreadId(rawChannelId)
|
||||
: undefined;
|
||||
return resolveDiscordBoundConversationRoute({
|
||||
cfg,
|
||||
accountId,
|
||||
guildId: interaction.guild?.id ?? undefined,
|
||||
memberRoleIds,
|
||||
peer: buildDiscordRoutePeer({
|
||||
isDirectMessage,
|
||||
isGroupDm,
|
||||
directUserId: interaction.user?.id ?? rawChannelId,
|
||||
conversationId: rawChannelId,
|
||||
}),
|
||||
isDirectMessage,
|
||||
isGroupDm,
|
||||
directUserId: interaction.user?.id ?? rawChannelId,
|
||||
conversationId: rawChannelId,
|
||||
parentConversationId: threadParentId,
|
||||
});
|
||||
|
||||
const threadBinding = isThreadChannel
|
||||
? params.threadBindings.getByThreadId(rawChannelId)
|
||||
: undefined;
|
||||
return resolveDiscordEffectiveRoute({
|
||||
route,
|
||||
boundSessionKey: threadBinding?.targetSessionKey,
|
||||
});
|
||||
}
|
||||
@@ -1605,18 +1598,18 @@ async function dispatchDiscordCommandInteraction(params: {
|
||||
const isGuild = Boolean(interaction.guild);
|
||||
const channelId = rawChannelId || "unknown";
|
||||
const interactionId = interaction.rawData.id;
|
||||
const route = resolveDiscordConversationRoute({
|
||||
const route = resolveDiscordBoundConversationRoute({
|
||||
cfg,
|
||||
accountId,
|
||||
guildId: interaction.guild?.id ?? undefined,
|
||||
memberRoleIds,
|
||||
peer: buildDiscordRoutePeer({
|
||||
isDirectMessage,
|
||||
isGroupDm,
|
||||
directUserId: user.id,
|
||||
conversationId: channelId,
|
||||
}),
|
||||
isDirectMessage,
|
||||
isGroupDm,
|
||||
directUserId: user.id,
|
||||
conversationId: channelId,
|
||||
parentConversationId: threadParentId,
|
||||
// Configured ACP routes apply after raw route resolution, so do not pass
|
||||
// bound/configured overrides here.
|
||||
});
|
||||
const threadBinding = isThreadChannel ? threadBindings.getByThreadId(rawChannelId) : undefined;
|
||||
const configuredRoute =
|
||||
|
||||
Reference in New Issue
Block a user