mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 12:47:39 +00:00
fix: trim legacy signature fallback, type fromChatType as union
This commit is contained in:
@@ -253,6 +253,8 @@ export function describeReplyTarget(msg: Message): TelegramReplyTarget | null {
|
||||
};
|
||||
}
|
||||
|
||||
export type TelegramChatType = "private" | "group" | "supergroup" | "channel";
|
||||
|
||||
export type TelegramForwardedContext = {
|
||||
from: string;
|
||||
date?: number;
|
||||
@@ -262,7 +264,7 @@ export type TelegramForwardedContext = {
|
||||
fromTitle?: string;
|
||||
fromSignature?: string;
|
||||
/** Original chat type from forward_from_chat (e.g. "channel", "supergroup", "group"). */
|
||||
fromChatType?: string;
|
||||
fromChatType?: TelegramChatType;
|
||||
/** Original message ID in the source chat (channel forwards). */
|
||||
fromMessageId?: number;
|
||||
};
|
||||
@@ -336,7 +338,7 @@ function buildForwardedContextFromChat(params: {
|
||||
}
|
||||
const signature = params.signature?.trim() || undefined;
|
||||
const from = signature ? `${display} (${signature})` : display;
|
||||
const chatType = params.chat.type?.trim() || undefined;
|
||||
const chatType = (params.chat.type?.trim() || undefined) as TelegramChatType | undefined;
|
||||
return {
|
||||
from,
|
||||
date: params.date,
|
||||
|
||||
Reference in New Issue
Block a user