mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 05:40:35 +00:00
fix(slack): suppress NO_REPLY before Slack API call
Guard sendMessageSlack against NO_REPLY tokens reaching the Slack API,
which caused truncated push notifications before the reply filter could
intercept them.
Made-with: Cursor
(cherry picked from commit fab9b52039)
This commit is contained in:
committed by
Peter Steinberger
parent
9c142993b8
commit
eb9a968336
@@ -9,6 +9,7 @@ import {
|
||||
resolveChunkMode,
|
||||
resolveTextChunkLimit,
|
||||
} from "../auto-reply/chunk.js";
|
||||
import { isSilentReplyText } from "../auto-reply/tokens.js";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import { resolveMarkdownTableMode } from "../config/markdown-tables.js";
|
||||
import { logVerbose } from "../globals.js";
|
||||
@@ -231,6 +232,10 @@ export async function sendMessageSlack(
|
||||
opts: SlackSendOpts = {},
|
||||
): Promise<SlackSendResult> {
|
||||
const trimmedMessage = message?.trim() ?? "";
|
||||
if (isSilentReplyText(trimmedMessage) && !opts.mediaUrl && !opts.blocks) {
|
||||
logVerbose("slack send: suppressed NO_REPLY token before API call");
|
||||
return { messageId: "suppressed", channelId: "" };
|
||||
}
|
||||
const blocks = opts.blocks == null ? undefined : validateSlackBlocksArray(opts.blocks);
|
||||
if (!trimmedMessage && !opts.mediaUrl && !blocks) {
|
||||
throw new Error("Slack send requires text, blocks, or media");
|
||||
|
||||
Reference in New Issue
Block a user