mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:09:35 +00:00
feat(telegram/acp): Topic Binding, Pin Binding Message, Fix Spawn Param Parsing (#36683)
* fix(acp): normalize unicode flags and Telegram topic binding * feat(telegram/acp): restore topic-bound ACP and session bindings * fix(acpx): clarify permission-denied guidance * feat(telegram/acp): pin spawn bind notice in topics * docs(telegram): document ACP topic thread binding behavior * refactor(reply): share Telegram conversation-id resolver * fix(telegram/acp): preserve bound session routing semantics * fix(telegram): respect binding persistence and expiry reporting * refactor(telegram): simplify binding lifecycle persistence * fix(telegram): bind acp spawns in direct messages * fix: document telegram ACP topic binding changelog (#36683) (thanks @huntharo) --------- Co-authored-by: Onur <2453968+osolmaz@users.noreply.github.com>
This commit is contained in:
45
src/auto-reply/reply/channel-context.ts
Normal file
45
src/auto-reply/reply/channel-context.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
type DiscordSurfaceParams = {
|
||||
ctx: {
|
||||
OriginatingChannel?: string;
|
||||
Surface?: string;
|
||||
Provider?: string;
|
||||
AccountId?: string;
|
||||
};
|
||||
command: {
|
||||
channel?: string;
|
||||
};
|
||||
};
|
||||
|
||||
type DiscordAccountParams = {
|
||||
ctx: {
|
||||
AccountId?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export function isDiscordSurface(params: DiscordSurfaceParams): boolean {
|
||||
return resolveCommandSurfaceChannel(params) === "discord";
|
||||
}
|
||||
|
||||
export function isTelegramSurface(params: DiscordSurfaceParams): boolean {
|
||||
return resolveCommandSurfaceChannel(params) === "telegram";
|
||||
}
|
||||
|
||||
export function resolveCommandSurfaceChannel(params: DiscordSurfaceParams): string {
|
||||
const channel =
|
||||
params.ctx.OriginatingChannel ??
|
||||
params.command.channel ??
|
||||
params.ctx.Surface ??
|
||||
params.ctx.Provider;
|
||||
return String(channel ?? "")
|
||||
.trim()
|
||||
.toLowerCase();
|
||||
}
|
||||
|
||||
export function resolveDiscordAccountId(params: DiscordAccountParams): string {
|
||||
return resolveChannelAccountId(params);
|
||||
}
|
||||
|
||||
export function resolveChannelAccountId(params: DiscordAccountParams): string {
|
||||
const accountId = typeof params.ctx.AccountId === "string" ? params.ctx.AccountId.trim() : "";
|
||||
return accountId || "default";
|
||||
}
|
||||
Reference in New Issue
Block a user