mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 23:08:28 +00:00
refactor: require target for message actions
This commit is contained in:
50
src/infra/outbound/message-action-spec.ts
Normal file
50
src/infra/outbound/message-action-spec.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import type { ChannelMessageActionName } from "../../channels/plugins/types.js";
|
||||
|
||||
export type MessageActionTargetMode = "to" | "channelId" | "none";
|
||||
|
||||
export const MESSAGE_ACTION_TARGET_MODE: Record<ChannelMessageActionName, MessageActionTargetMode> =
|
||||
{
|
||||
send: "to",
|
||||
broadcast: "none",
|
||||
poll: "to",
|
||||
react: "to",
|
||||
reactions: "to",
|
||||
read: "to",
|
||||
edit: "to",
|
||||
delete: "to",
|
||||
pin: "to",
|
||||
unpin: "to",
|
||||
"list-pins": "to",
|
||||
permissions: "to",
|
||||
"thread-create": "to",
|
||||
"thread-list": "none",
|
||||
"thread-reply": "to",
|
||||
search: "none",
|
||||
sticker: "to",
|
||||
"member-info": "none",
|
||||
"role-info": "none",
|
||||
"emoji-list": "none",
|
||||
"emoji-upload": "none",
|
||||
"sticker-upload": "none",
|
||||
"role-add": "none",
|
||||
"role-remove": "none",
|
||||
"channel-info": "channelId",
|
||||
"channel-list": "none",
|
||||
"channel-create": "none",
|
||||
"channel-edit": "channelId",
|
||||
"channel-delete": "channelId",
|
||||
"channel-move": "channelId",
|
||||
"category-create": "none",
|
||||
"category-edit": "none",
|
||||
"category-delete": "none",
|
||||
"voice-status": "none",
|
||||
"event-list": "none",
|
||||
"event-create": "none",
|
||||
timeout: "none",
|
||||
kick: "none",
|
||||
ban: "none",
|
||||
};
|
||||
|
||||
export function actionRequiresTarget(action: ChannelMessageActionName): boolean {
|
||||
return MESSAGE_ACTION_TARGET_MODE[action] !== "none";
|
||||
}
|
||||
Reference in New Issue
Block a user