| 28 | } |
| 29 | |
| 30 | function send_message(state: SessionState, content: string) { |
| 31 | if (!plugin.config!.notifications.enableProactiveNotifications) return; |
| 32 | if (state.channelId && state.targetId) |
| 33 | spawnSync('openclaw', [ |
| 34 | 'message', 'send', |
| 35 | '--channel', state.channelId, |
| 36 | '--target', state.targetId, |
| 37 | '--message', content |
| 38 | ], { stdio: 'inherit' }); |
| 39 | else |
| 40 | getLogger().error("[Enforcement] No channel to send message."); |
| 41 | } |
| 42 | |
| 43 | function clampText(text: string, maxChars: number): string { |
| 44 | if (maxChars <= 0) return ""; |