mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-23 15:11:42 +00:00
fix(regression): preserve announce thread ids
This commit is contained in:
@@ -97,4 +97,14 @@ describe("resolveAnnounceTargetFromKey", () => {
|
||||
threadId: "99",
|
||||
});
|
||||
});
|
||||
|
||||
it("preserves decimal thread ids for Slack-style session keys", () => {
|
||||
expect(
|
||||
resolveAnnounceTargetFromKey("agent:main:slack:channel:general:thread:1699999999.0001"),
|
||||
).toEqual({
|
||||
channel: "slack",
|
||||
to: "channel:general",
|
||||
threadId: "1699999999.0001",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -32,8 +32,8 @@ export function resolveAnnounceTargetFromKey(sessionKey: string): AnnounceTarget
|
||||
// Telegram uses :topic:, other platforms use :thread:
|
||||
let threadId: string | undefined;
|
||||
const restJoined = rest.join(":");
|
||||
const topicMatch = restJoined.match(/:topic:(\d+)$/);
|
||||
const threadMatch = restJoined.match(/:thread:(\d+)$/);
|
||||
const topicMatch = restJoined.match(/:topic:([^:]+)$/);
|
||||
const threadMatch = restJoined.match(/:thread:([^:]+)$/);
|
||||
const match = topicMatch || threadMatch;
|
||||
|
||||
if (match) {
|
||||
@@ -41,7 +41,7 @@ export function resolveAnnounceTargetFromKey(sessionKey: string): AnnounceTarget
|
||||
}
|
||||
|
||||
// Remove :topic:N or :thread:N suffix from ID for target
|
||||
const id = match ? restJoined.replace(/:(topic|thread):\d+$/, "") : restJoined.trim();
|
||||
const id = match ? restJoined.replace(/:(topic|thread):[^:]+$/, "") : restJoined.trim();
|
||||
|
||||
if (!id) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user