mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 16:51:25 +00:00
feat(discord): add silent message support (SUPPRESS_NOTIFICATIONS flag)
- Add silent option to message tool for Discord - Passes SUPPRESS_NOTIFICATIONS flag (4096) to Discord API - Threads silent param through entire outbound chain: - message-action-runner.ts - outbound-send-service.ts - message.ts - deliver.ts - discord outbound adapter - send.outbound.ts - send.shared.ts Usage: message tool with silent=true suppresses push/desktop notifications
This commit is contained in:
@@ -86,6 +86,7 @@ async function createChannelHandler(params: {
|
||||
threadId?: string | number | null;
|
||||
deps?: OutboundSendDeps;
|
||||
gifPlayback?: boolean;
|
||||
silent?: boolean;
|
||||
}): Promise<ChannelHandler> {
|
||||
const outbound = await loadChannelOutboundAdapter(params.channel);
|
||||
if (!outbound?.sendText || !outbound?.sendMedia) {
|
||||
@@ -101,6 +102,7 @@ async function createChannelHandler(params: {
|
||||
threadId: params.threadId,
|
||||
deps: params.deps,
|
||||
gifPlayback: params.gifPlayback,
|
||||
silent: params.silent,
|
||||
});
|
||||
if (!handler) {
|
||||
throw new Error(`Outbound not configured for channel: ${params.channel}`);
|
||||
@@ -118,6 +120,7 @@ function createPluginHandler(params: {
|
||||
threadId?: string | number | null;
|
||||
deps?: OutboundSendDeps;
|
||||
gifPlayback?: boolean;
|
||||
silent?: boolean;
|
||||
}): ChannelHandler | null {
|
||||
const outbound = params.outbound;
|
||||
if (!outbound?.sendText || !outbound?.sendMedia) {
|
||||
@@ -143,6 +146,7 @@ function createPluginHandler(params: {
|
||||
threadId: params.threadId,
|
||||
gifPlayback: params.gifPlayback,
|
||||
deps: params.deps,
|
||||
silent: params.silent,
|
||||
payload,
|
||||
})
|
||||
: undefined,
|
||||
@@ -156,6 +160,7 @@ function createPluginHandler(params: {
|
||||
threadId: params.threadId,
|
||||
gifPlayback: params.gifPlayback,
|
||||
deps: params.deps,
|
||||
silent: params.silent,
|
||||
}),
|
||||
sendMedia: async (caption, mediaUrl) =>
|
||||
sendMedia({
|
||||
@@ -168,6 +173,7 @@ function createPluginHandler(params: {
|
||||
threadId: params.threadId,
|
||||
gifPlayback: params.gifPlayback,
|
||||
deps: params.deps,
|
||||
silent: params.silent,
|
||||
}),
|
||||
};
|
||||
}
|
||||
@@ -192,6 +198,7 @@ export async function deliverOutboundPayloads(params: {
|
||||
text?: string;
|
||||
mediaUrls?: string[];
|
||||
};
|
||||
silent?: boolean;
|
||||
}): Promise<OutboundDeliveryResult[]> {
|
||||
const { cfg, channel, to, payloads } = params;
|
||||
const accountId = params.accountId;
|
||||
@@ -208,6 +215,7 @@ export async function deliverOutboundPayloads(params: {
|
||||
replyToId: params.replyToId,
|
||||
threadId: params.threadId,
|
||||
gifPlayback: params.gifPlayback,
|
||||
silent: params.silent,
|
||||
});
|
||||
const textLimit = handler.chunker
|
||||
? resolveTextChunkLimit(cfg, channel, accountId, {
|
||||
|
||||
@@ -820,6 +820,7 @@ async function handleSendAction(ctx: ResolvedActionContext): Promise<MessageActi
|
||||
params.message = message;
|
||||
const gifPlayback = readBooleanParam(params, "gifPlayback") ?? false;
|
||||
const bestEffort = readBooleanParam(params, "bestEffort");
|
||||
const silent = readBooleanParam(params, "silent");
|
||||
|
||||
const replyToId = readStringParam(params, "replyTo");
|
||||
const threadId = readStringParam(params, "threadId");
|
||||
@@ -884,6 +885,7 @@ async function handleSendAction(ctx: ResolvedActionContext): Promise<MessageActi
|
||||
}
|
||||
: undefined,
|
||||
abortSignal,
|
||||
silent: silent ?? undefined,
|
||||
},
|
||||
to,
|
||||
message,
|
||||
|
||||
@@ -51,6 +51,7 @@ type MessageSendParams = {
|
||||
mediaUrls?: string[];
|
||||
};
|
||||
abortSignal?: AbortSignal;
|
||||
silent?: boolean;
|
||||
};
|
||||
|
||||
export type MessageSendResult = {
|
||||
@@ -173,6 +174,7 @@ export async function sendMessage(params: MessageSendParams): Promise<MessageSen
|
||||
deps: params.deps,
|
||||
bestEffort: params.bestEffort,
|
||||
abortSignal: params.abortSignal,
|
||||
silent: params.silent,
|
||||
mirror: params.mirror
|
||||
? {
|
||||
...params.mirror,
|
||||
|
||||
@@ -34,6 +34,7 @@ export type OutboundSendContext = {
|
||||
mediaUrls?: string[];
|
||||
};
|
||||
abortSignal?: AbortSignal;
|
||||
silent?: boolean;
|
||||
};
|
||||
|
||||
function extractToolPayload(result: AgentToolResult<unknown>): unknown {
|
||||
@@ -128,6 +129,7 @@ export async function executeSendAction(params: {
|
||||
gateway: params.ctx.gateway,
|
||||
mirror: params.ctx.mirror,
|
||||
abortSignal: params.ctx.abortSignal,
|
||||
silent: params.ctx.silent,
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user