refactor: prune legacy group prefixes
This commit is contained in:
@@ -223,7 +223,7 @@ export async function processDiscordMessage(ctx: DiscordMessagePreflightContext)
|
||||
|
||||
const effectiveFrom = isDirectMessage
|
||||
? `discord:${author.id}`
|
||||
: (autoThreadContext?.From ?? `group:${message.channelId}`);
|
||||
: (autoThreadContext?.From ?? `discord:channel:${message.channelId}`);
|
||||
const effectiveTo = autoThreadContext?.To ?? replyTarget;
|
||||
if (!effectiveTo) {
|
||||
runtime.error?.(danger("discord: missing reply target"));
|
||||
|
||||
@@ -601,7 +601,11 @@ async function dispatchDiscordCommandInteraction(params: {
|
||||
RawBody: prompt,
|
||||
CommandBody: prompt,
|
||||
CommandArgs: commandArgs,
|
||||
From: isDirectMessage ? `discord:${user.id}` : `group:${channelId}`,
|
||||
From: isDirectMessage
|
||||
? `discord:${user.id}`
|
||||
: isGroupDm
|
||||
? `discord:group:${channelId}`
|
||||
: `discord:channel:${channelId}`,
|
||||
To: `slash:${user.id}`,
|
||||
SessionKey: `agent:${route.agentId}:${sessionPrefix}:${user.id}`,
|
||||
CommandTargetSessionKey: route.sessionKey,
|
||||
|
||||
@@ -28,7 +28,7 @@ describe("resolveDiscordAutoThreadContext", () => {
|
||||
});
|
||||
expect(context).not.toBeNull();
|
||||
expect(context?.To).toBe("channel:thread");
|
||||
expect(context?.From).toBe("group:thread");
|
||||
expect(context?.From).toBe("discord:channel:thread");
|
||||
expect(context?.OriginatingTo).toBe("channel:thread");
|
||||
expect(context?.SessionKey).toBe(
|
||||
buildAgentSessionKey({
|
||||
|
||||
@@ -194,7 +194,7 @@ export function resolveDiscordAutoThreadContext(params: {
|
||||
|
||||
return {
|
||||
createdThreadId,
|
||||
From: `group:${createdThreadId}`,
|
||||
From: `${params.channel}:channel:${createdThreadId}`,
|
||||
To: `channel:${createdThreadId}`,
|
||||
OriginatingTo: `channel:${createdThreadId}`,
|
||||
SessionKey: threadSessionKey,
|
||||
|
||||
Reference in New Issue
Block a user