This commit is contained in:
2026-02-06 21:22:20 +03:00
parent ae431f6258
commit 21ab362776
+4 -1
View File
@@ -471,7 +471,10 @@ export async function getUserAvatar(userId: number): Promise<Buffer | null> {
} }
export function extractTextMessage(msg: Message | StoredMessage | string): string | null { export function extractTextMessage(msg: Message | StoredMessage | string): string | null {
const text = (typeof msg === "string" ? msg : isStoredMessage(msg) ? msg.text : msg?.text ?? msg?.caption ?? "").trim(); if (!msg) return null;
if (typeof msg === "string") return msg;
const text = (isStoredMessage(msg) ? msg.text : msg.text || msg.caption || "").trim();
if (text.length === 0) return null; if (text.length === 0) return null;
return text; return text;
} }