

























@@ -116,6 +116,7 @@ export async function deliverReplies(params: {
116116117117export type SlackRespondFn = (payload: {
118118text: string;
119+blocks?: ReturnType<typeof readSlackReplyBlocks>;
119120response_type?: "ephemeral" | "in_channel";
120121}) => Promise<unknown>;
121122@@ -202,14 +203,19 @@ export async function deliverSlackSlashReplies(params: {
202203tableMode?: MarkdownTableMode;
203204chunkMode?: ChunkMode;
204205}) {
205-const messages: string[] = [];
206+const messages: Array<{ text: string; blocks?: ReturnType<typeof readSlackReplyBlocks> }> = [];
206207const chunkLimit = Math.min(params.textLimit, SLACK_TEXT_LIMIT);
207208for (const payload of params.replies) {
208209const reply = resolveSendableOutboundReplyParts(payload);
210+const slackBlocks = readSlackReplyBlocks(payload);
209211const text =
210212reply.hasText && !isSilentReplyText(reply.trimmedText, SILENT_REPLY_TOKEN)
211213 ? reply.trimmedText
212214 : undefined;
215+if (slackBlocks?.length && !reply.hasMedia) {
216+messages.push({ text: text ?? "", blocks: slackBlocks });
217+continue;
218+}
213219const combined = [text ?? "", ...reply.mediaUrls].filter(Boolean).join("\n");
214220if (!combined) {
215221continue;
@@ -226,7 +232,7 @@ export async function deliverSlackSlashReplies(params: {
226232chunks.push(combined);
227233}
228234for (const chunk of chunks) {
229-messages.push(chunk);
235+messages.push({ text: chunk });
230236}
231237}
232238@@ -236,7 +242,7 @@ export async function deliverSlackSlashReplies(params: {
236242237243// Slack slash command responses can be multi-part by sending follow-ups via response_url.
238244const responseType = params.ephemeral ? "ephemeral" : "in_channel";
239-for (const text of messages) {
240-await params.respond({ text, response_type: responseType });
245+for (const message of messages) {
246+await params.respond({ ...message, response_type: responseType });
241247}
242248}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。