This commit is contained in:
Matt Keenan 2026-01-30 07:47:24 -08:00 committed by GitHub
commit d87b2b8db9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 19 additions and 2 deletions

View File

@ -77,6 +77,11 @@ export const googlechatMessageActions: ChannelMessageActionAdapter = {
}
if (action === "send") {
const actionConfig = account.config.actions ?? (cfg as OpenClawConfig).channels?.["googlechat"]?.actions;
const isActionEnabled = createActionGate(actionConfig as Record<string, boolean | undefined>);
if (!isActionEnabled("sendMessage")) {
throw new Error("Google Chat sendMessage is disabled.");
}
const to = readStringParam(params, "to", { required: true });
const content = readStringParam(params, "message", {
required: true,

View File

@ -51,6 +51,11 @@ export const matrixMessageActions: ChannelMessageActionAdapter = {
readStringParam(params, "to", { required: true });
if (action === "send") {
const account = resolveMatrixAccount({ cfg: cfg as CoreConfig });
const isActionEnabled = createActionGate((cfg as CoreConfig).channels?.matrix?.actions);
if (!isActionEnabled("sendMessage")) {
throw new Error("Matrix sendMessage is disabled.");
}
const to = readStringParam(params, "to", { required: true });
const content = readStringParam(params, "message", {
required: true,

View File

@ -6,6 +6,7 @@ const allowFromEntry = z.union([z.string(), z.number()]);
const matrixActionSchema = z
.object({
reactions: z.boolean().optional(),
sendMessage: z.boolean().optional(),
messages: z.boolean().optional(),
pins: z.boolean().optional(),
memberInfo: z.boolean().optional(),

View File

@ -222,8 +222,8 @@ export async function handleDiscordMessagingAction(
});
}
case "sendMessage": {
if (!isActionEnabled("messages")) {
throw new Error("Discord message sends are disabled.");
if (!isActionEnabled("sendMessage")) {
throw new Error("Discord sendMessage is disabled.");
}
const to = readStringParam(params, "to", { required: true });
const content = readStringParam(params, "content", {

View File

@ -154,6 +154,9 @@ export async function handleSlackAction(
}
switch (action) {
case "sendMessage": {
if (!isActionEnabled("sendMessage")) {
throw new Error("Slack sendMessage is disabled.");
}
const to = readStringParam(params, "to", { required: true });
const content = readStringParam(params, "content", { required: true });
const mediaUrl = readStringParam(params, "mediaUrl");

View File

@ -55,6 +55,7 @@ export type DiscordGuildEntry = {
export type DiscordActionConfig = {
reactions?: boolean;
sendMessage?: boolean;
stickers?: boolean;
polls?: boolean;
permissions?: boolean;

View File

@ -30,6 +30,7 @@ export type GoogleChatGroupConfig = {
export type GoogleChatActionConfig = {
reactions?: boolean;
sendMessage?: boolean;
};
export type GoogleChatAccountConfig = {

View File

@ -48,6 +48,7 @@ export type SlackReactionNotificationMode = "off" | "own" | "all" | "allowlist";
export type SlackActionConfig = {
reactions?: boolean;
sendMessage?: boolean;
messages?: boolean;
pins?: boolean;
search?: boolean;