refactor: prune legacy group prefixes
This commit is contained in:
@@ -309,7 +309,6 @@ export function createSessionStatusTool(opts?: {
|
||||
const isGroup =
|
||||
resolved.entry.chatType === "group" ||
|
||||
resolved.entry.chatType === "channel" ||
|
||||
resolved.key.startsWith("group:") ||
|
||||
resolved.key.includes(":group:") ||
|
||||
resolved.key.includes(":channel:");
|
||||
const groupActivation = isGroup
|
||||
|
||||
@@ -68,7 +68,7 @@ export function classifySessionKind(params: {
|
||||
if (key.startsWith("hook:")) return "hook";
|
||||
if (key.startsWith("node-") || key.startsWith("node:")) return "node";
|
||||
if (params.gatewayKind === "group") return "group";
|
||||
if (key.startsWith("group:") || key.includes(":group:") || key.includes(":channel:")) {
|
||||
if (key.includes(":group:") || key.includes(":channel:")) {
|
||||
return "group";
|
||||
}
|
||||
return "other";
|
||||
|
||||
@@ -23,11 +23,13 @@ export function resolveAnnounceTargetFromKey(sessionKey: string): AnnounceTarget
|
||||
if (!channelRaw) return null;
|
||||
const normalizedChannel = normalizeChannelId(channelRaw);
|
||||
const channel = normalizedChannel ?? channelRaw.toLowerCase();
|
||||
const kindTarget = normalizedChannel
|
||||
? kind === "channel"
|
||||
? `channel:${id}`
|
||||
: `group:${id}`
|
||||
: id;
|
||||
const kindTarget = (() => {
|
||||
if (!normalizedChannel) return id;
|
||||
if (normalizedChannel === "discord" || normalizedChannel === "slack") {
|
||||
return `channel:${id}`;
|
||||
}
|
||||
return kind === "channel" ? `channel:${id}` : `group:${id}`;
|
||||
})();
|
||||
const normalized = normalizedChannel
|
||||
? getChannelPlugin(normalizedChannel)?.messaging?.normalizeTarget?.(kindTarget)
|
||||
: undefined;
|
||||
|
||||
Reference in New Issue
Block a user