fix: resolve cron task creation and execution failures
This commit is contained in:
parent
08fc305d5e
commit
c8ac5e5ecc
1 changed files with 1 additions and 4 deletions
|
|
@ -8,7 +8,6 @@ import (
|
||||||
|
|
||||||
"github.com/sipeed/picoclaw/pkg/bus"
|
"github.com/sipeed/picoclaw/pkg/bus"
|
||||||
"github.com/sipeed/picoclaw/pkg/config"
|
"github.com/sipeed/picoclaw/pkg/config"
|
||||||
"github.com/sipeed/picoclaw/pkg/constants"
|
|
||||||
"github.com/sipeed/picoclaw/pkg/cron"
|
"github.com/sipeed/picoclaw/pkg/cron"
|
||||||
"github.com/sipeed/picoclaw/pkg/utils"
|
"github.com/sipeed/picoclaw/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
@ -199,9 +198,6 @@ func (t *CronTool) addJob(ctx context.Context, args map[string]any) *ToolResult
|
||||||
if !t.execEnabled {
|
if !t.execEnabled {
|
||||||
return ErrorResult("command execution is disabled")
|
return ErrorResult("command execution is disabled")
|
||||||
}
|
}
|
||||||
if !constants.IsInternalChannel(channel) {
|
|
||||||
return ErrorResult("scheduling command execution is restricted to internal channels")
|
|
||||||
}
|
|
||||||
if !t.allowCommand && !commandConfirm {
|
if !t.allowCommand && !commandConfirm {
|
||||||
return ErrorResult("command_confirm=true is required when allow_command is disabled")
|
return ErrorResult("command_confirm=true is required when allow_command is disabled")
|
||||||
}
|
}
|
||||||
|
|
@ -318,6 +314,7 @@ func (t *CronTool) ExecuteJob(ctx context.Context, job *cron.CronJob) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
args := map[string]any{
|
args := map[string]any{
|
||||||
|
"action": "run",
|
||||||
"command": job.Payload.Command,
|
"command": job.Payload.Command,
|
||||||
"__channel": channel,
|
"__channel": channel,
|
||||||
"__chat_id": chatID,
|
"__chat_id": chatID,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue