mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-14 21:00:46 +00:00
Co-authored-by: openclaw-clawsweeper[bot] <280122609+openclaw-clawsweeper[bot]@users.noreply.github.com>
19 lines
561 B
TypeScript
19 lines
561 B
TypeScript
import type { Block, KnownBlock } from "@slack/web-api";
|
|
import { buildSlackBlocksFallbackText } from "./blocks-fallback.js";
|
|
import { SLACK_TEXT_LIMIT } from "./limits.js";
|
|
import { truncateSlackText } from "./truncate.js";
|
|
|
|
export function buildSlackEditTextPayload(
|
|
content: string,
|
|
blocks?: (Block | KnownBlock)[],
|
|
): string {
|
|
const trimmedContent = content.trim();
|
|
if (trimmedContent) {
|
|
return trimmedContent;
|
|
}
|
|
if (blocks?.length) {
|
|
return truncateSlackText(buildSlackBlocksFallbackText(blocks), SLACK_TEXT_LIMIT);
|
|
}
|
|
return " ";
|
|
}
|