Files
conquest/server/agent/taskDispatcher.nim
2025-07-15 22:38:01 +02:00

17 lines
604 B
Nim

import nanoid, sequtils, strutils, strformat, terminal, times, json
import ../types
import ../db/database
# Generic task creation procedure
proc createTask*(cq: Conquest, command: CommandType, args: string, message: string) =
let
date = now().format("dd-MM-yyyy HH:mm:ss")
task = Task(
id: generate(alphabet=join(toSeq('A'..'Z'), ""), size=8),
agent: cq.interactAgent.name,
command: command,
args: args,
)
cq.interactAgent.tasks.add(task)
cq.writeLine(fgBlack, styleBright, fmt"[{date}] [*] ", resetStyle, message)