openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.14 kB
JavaScript
import{a as resolveCommandAuthorizationAsync}from"./command-auth-CCzMsjar.mjs";import{t as shouldHandleTextCommands}from"./commands-text-routing-CDTqRuxF.mjs";import{n as resolveCommandContextText}from"./context-text-0KLy58TB.mjs";import{t as buildCommandContext}from"./commands-context-c5lPk2Z8.mjs";import{t as handleApproveCommandFromContext}from"./commands-approve-jCoi5yEl.mjs";
//!src/auto-reply/reply/fast-approve.ts
async function tryFastApproveFromMessage(e){const t=resolveCommandContextText(e.ctx);if(!/^\/approve(?:@[^\s]+)?(?:\s|$)/i.test(t))return{handled:false};const n={ctx:e.ctx,cfg:e.cfg,agentId:e.agentId,sessionKey:e.sessionKey,isGroup:e.ctx.ChatType===`group`||e.ctx.ChatType===`channel`,triggerBodyNormalized:t,commandAuthorized:e.ctx.CommandAuthorized};const r=buildCommandContext(n,await resolveCommandAuthorizationAsync(n));const i=await handleApproveCommandFromContext({cfg:e.cfg,ctx:e.ctx,command:r},shouldHandleTextCommands({cfg:e.cfg,surface:r.surface,commandSource:e.ctx.CommandSource}));return i&&!i.shouldContinue?{handled:true,...i.reply?{reply:i.reply}:{}}:{handled:false}}export{tryFastApproveFromMessage};