Demo-Slap Highlight Skill
Generate MP4 highlights and fragmovies from CS2 demos.
This skill is designed for OpenClaw environments where background jobs, local helper scripts, and chat-aware delivery are available. It uses Python 3 scripts and the requests package for HTTP API access.
Expected runtime inputs:
- - Required: INLINECODE1
- Optional: INLINECODE2
- Optional deployment helper: INLINECODE3
Scripts
Run bundled scripts relative to the skill root, usually from scripts/.
Demo-Slap
| Script | Purpose |
|---|
| INLINECODE5 | List recent matches from Demo-Slap INLINECODE6 |
| INLINECODE7 |
Try to resolve replay/demo URL from Demo-Slap match history by index; fail clearly if the API exposes only
jobId |
|
demo_slap_match_pick.py | Pick a Demo-Slap match by index and return structured match info including
jobId |
|
demo_slap_analyze.py | Submit a demo for analysis, poll until done, output highlights JSON |
|
demo_slap_render.py | Render one or more highlights, poll until done, output clip URL |
|
demo_slap_common.py | Shared utilities (config, API calls, state) |
Leetify
| Script | Purpose |
|---|
| INLINECODE14 | List recent matches |
| INLINECODE15 |
Resolve replay URL by username + match index |
|
leetify/leetify_save_id.py | Save username -> Steam64 ID mapping |
|
leetify/leetify_common.py | Shared Leetify utilities |
Match source selection
- - Prefer Leetify for recent match discovery when
LEETIFY_API_KEY is available. - If
LEETIFY_API_KEY is not configured but DEMOSLAP_API_KEY is available, use Demo-Slap match history from /public-api/matches. - Swagger: INLINECODE22
- Treat Demo-Slap match history as the fallback discovery path for listing matches and selecting an existing analyzed match or replay context before analyze/render.
Runtime files
Use these files as optional local runtime state during execution:
- - INLINECODE23
- INLINECODE24
- INLINECODE25
- INLINECODE26
- INLINECODE27
These files are runtime helpers for local operation and are not required to understand or inspect the skill package itself.
INLINECODE28 tracks the current operation:
CODEBLOCK0
Workflow
1. Find the match
Preferred path when
LEETIFY_API_KEY is available:
CODEBLOCK1
Fallback path when LEETIFY_API_KEY is missing but DEMOSLAP_API_KEY is available:
python3 scripts/demo_slap_matches.py [<USERNAME>] [--limit 10]
- - uses Demo-Slap INLINECODE32
- use the Demo-Slap swagger docs at
https://api-doc.demo-slap.net/ if schema details are needed - if
<USERNAME> is provided and mapped, filter matches to that player's Steam ID when possible - after the user picks a match, run:
python3 scripts/demo_slap_match_pick.py [<USERNAME>] --match-index <N>
- - treat the returned
jobId as the primary handle for downstream Demo-Slap operations
2. Resolve replay URL
Preferred path when using Leetify:
CODEBLOCK4
When using Demo-Slap fallback:
python3 scripts/demo_slap_match_pick.py [<USERNAME>] --match-index <N>
- - use the returned
jobId as the selected match identifier - if
demoUrl is present, you may still use analyze-by-URL - if
demoUrl is absent, skip URL resolution and continue by API endpoints that accept the existing analyze INLINECODE39 - use
GET /public-api/analyze/{jobId}/status and GET /public-api/analyze/{jobId}/data to inspect existing highlights - if the user wants clips and highlights already exist, render directly from that INLINECODE42
3. Analyze in background
CODEBLOCK6
Run with exec(background: true) and keep the returned process/session id.
Optional deployment-specific watchdog pattern for OpenClaw environments:
- - Use a watchdog only when background analyze/render work benefits from periodic delivery checks.
- Reuse an existing deployment watchdog when available instead of assuming a new persistent scheduler entry is always needed.
- If a deployment chooses to create or enable a watchdog through the built-in
cron tool, keep it scoped to the active run and disable it again after terminal delivery. - A 2 minute interval is a reasonable default.
- Use
scripts/demo_slap_watchdog.sh status|tail|job only as a local helper for inspecting runtime state, logs, or deployment-specific job references. - Treat
data/state.json and data/highlights.json as the source of truth during runtime.
Agent workflow:
- 1. Choose the match source:
- Leetify if
LEETIFY_API_KEY exists
- Demo-Slap
/public-api/matches if
LEETIFY_API_KEY is missing and
DEMOSLAP_API_KEY exists
- 2. If using Leetify, resolve the replay URL and run analyze
- If using Demo-Slap fallback, pick a match and inspect the returned INLINECODE52
- If the selected Demo-Slap match already has analyze data, continue by
jobId instead of forcing analyze-by-URL - Use or enable a deployment watchdog only when long-running analyze/render work benefits from it
- Launch analyze or render and save the returned process/session id when applicable
- Let the watchdog deliver the result when a deployment uses one
- Disable the watchdog again after terminal delivery
4. Render in background
CODEBLOCK7
Run with exec(background: true) and keep the returned process/session id.
Optional deployment-specific watchdog pattern for OpenClaw environments:
- - Use a watchdog only when background analyze/render work benefits from periodic delivery checks.
- Reuse an existing deployment watchdog when available instead of assuming a new persistent scheduler entry is always needed.
- If a deployment chooses to create or enable a watchdog through the built-in
cron tool, keep it scoped to the active run and disable it again after terminal delivery. - A 2 minute interval is a reasonable default.
- Use
scripts/demo_slap_watchdog.sh status|tail|job only as a local helper for inspecting runtime state, logs, or deployment-specific job references. - Treat
data/state.json and data/highlights.json as the source of truth during runtime.
Agent workflow:
- 1. Enable or reuse a deployment watchdog only when needed for the active run
- Launch render and save the returned process/session id
- Poll process output for the
Estimated finish: line and tell the user the ETA if present - Let the watchdog deliver the result when one is in use
- Disable the watchdog again after terminal delivery
Critical: set <CHAT_ID> from inbound metadata of the originating request. Treat hardcoded chat identifiers as local examples only, not as a reusable default.
5. Check status
Read
data/state.json.
Setup
Map username to Steam ID
CODEBLOCK8
Configure API keys
Prefer environment variables:
- -
DEMOSLAP_API_KEY - required - INLINECODE63 - optional, only for Leetify-backed match discovery
- INLINECODE64 - optional deployment-specific helper for watchdog inspection scripts
Source selection rules:
- - If
LEETIFY_API_KEY exists, use Leetify for match discovery. - If
LEETIFY_API_KEY is absent but DEMOSLAP_API_KEY exists, use Demo-Slap /public-api/matches for match discovery. - INLINECODE69 is always required for analyze/render.
Optional local fallback for controlled self-hosted setups: put them in data/config.json.
Support
For access and support, please join our Discord community: https://discord.gg/8nfh26W9wQ
Demo-Slap 高光片段技能
从CS2 Demo文件中生成MP4格式的高光片段和集锦视频。
该技能专为OpenClaw环境设计,支持后台任务、本地辅助脚本和基于聊天的交付功能。使用Python 3脚本和requests包进行HTTP API访问。
运行时输入要求:
- - 必需:DEMOSLAPAPIKEY
- 可选:LEETIFYAPIKEY
- 可选部署辅助:DEMOSLAPWATCHDOGJOBID
脚本
在技能根目录下运行捆绑脚本,通常从scripts/目录执行。
Demo-Slap
| 脚本 | 用途 |
|---|
| demoslapmatches.py | 从Demo-Slap的/public-api/matches接口列出最近比赛 |
| demoslapresolve.py |
尝试通过索引从Demo-Slap比赛历史中解析回放/Demo URL;如果API仅暴露jobId则明确报错 |
| demo
slapmatch_pick.py | 按索引选择Demo-Slap比赛,返回包含jobId的结构化比赛信息 |
| demo
slapanalyze.py | 提交Demo进行分析,轮询直至完成,输出高光片段JSON |
| demo
slaprender.py | 渲染一个或多个高光片段,轮询直至完成,输出剪辑URL |
| demo
slapcommon.py | 共享工具(配置、API调用、状态) |
Leetify
| 脚本 | 用途 |
|---|
| leetify/leetifymatches.py | 列出最近比赛 |
| leetify/leetifyresolve.py |
通过用户名+比赛索引解析回放URL |
| leetify/leetify
saveid.py | 保存用户名到Steam64 ID的映射 |
| leetify/leetify_common.py | 共享Leetify工具 |
比赛源选择
- - 当LEETIFYAPIKEY可用时,优先使用Leetify进行最近比赛发现。
- 如果未配置LEETIFYAPIKEY但DEMOSLAPAPIKEY可用,则使用Demo-Slap的/public-api/matches比赛历史。
- Swagger文档:https://api-doc.demo-slap.net/
- 将Demo-Slap比赛历史作为备选发现路径,用于在分析/渲染前列出比赛并选择现有已分析比赛或回放上下文。
运行时文件
在执行过程中使用以下文件作为可选的本地运行时状态:
- - data/state.json
- data/highlights.json
- data/history.log
- data/steam_ids.json
- data/config.json
这些文件是本地操作的运行时辅助文件,无需理解或检查技能包本身。
state.json跟踪当前操作:
json
{
status: idle|analyzing|rendering|done|error,
job_id: ...,
renderjobid: ...,
chat_id: telegram:182314856,
clipurls: {highlightid: https://...},
progress: polling 3/30,
lastcompletedop: analyze|render,
notification: {
sent: false,
sent_at: null,
lastattemptat: null,
error: null
},
updated_at: ISO timestamp
}
工作流程
1. 查找比赛
当LEETIFY
APIKEY可用时的首选路径:
bash
python3 scripts/leetify/leetify_matches.py
[--limit 10]
当LEETIFYAPIKEY缺失但DEMOSLAPAPIKEY可用时的备选路径:
bash
python3 scripts/demoslapmatches.py [] [--limit 10]
- - 使用Demo-Slap的/public-api/matches接口
- 如需架构详情,请参考https://api-doc.demo-slap.net/上的Demo-Slap Swagger文档
- 如果提供了且已映射,则尽可能按该玩家的Steam ID过滤比赛
- 用户选择比赛后,运行:
bash
python3 scripts/demoslapmatch_pick.py [] --match-index
- - 将返回的jobId作为下游Demo-Slap操作的主要句柄
2. 解析回放URL
使用Leetify时的首选路径:
bash
python3 scripts/leetify/leetify_resolve.py --match-index
使用Demo-Slap备选方案时:
bash
python3 scripts/demoslapmatch_pick.py [] --match-index
- - 使用返回的jobId作为所选比赛标识符
- 如果存在demoUrl,仍可使用按URL分析
- 如果demoUrl不存在,跳过URL解析,继续使用接受现有分析jobId的API端点
- 使用GET /public-api/analyze/{jobId}/status和GET /public-api/analyze/{jobId}/data检查现有高光片段
- 如果用户需要剪辑且高光片段已存在,直接从该jobId渲染
3. 后台分析
bash
python3 -u scripts/demoslapanalyze.py --url URL> --username --chat-id ID>
使用exec(background: true)运行并保留返回的进程/会话ID。
OpenClaw环境的可选部署特定看门狗模式:
- - 仅当后台分析/渲染工作需要定期交付检查时才使用看门狗。
- 尽可能重用现有部署看门狗,而不是假设始终需要新的持久调度器条目。
- 如果部署选择通过内置的cron工具创建或启用看门狗,请将其范围限定在活动运行中,并在终端交付后再次禁用它。
- 2分钟间隔是合理的默认值。
- 仅将scripts/demoslapwatchdog.sh status|tail|job用作检查运行时状态、日志或部署特定作业引用的本地辅助工具。
- 在运行时将data/state.json和data/highlights.json视为事实来源。
代理工作流程:
- 1. 选择比赛源:
- 如果存在LEETIFYAPIKEY则使用Leetify
- 如果LEETIFYAPIKEY缺失且DEMOSLAPAPIKEY存在,则使用Demo-Slap的/public-api/matches
- 2. 如果使用Leetify,解析回放URL并运行分析
- 如果使用Demo-Slap备选方案,选择比赛并检查返回的jobId
- 如果所选Demo-Slap比赛已有分析数据,则按jobId继续,而不是强制按URL分析
- 仅当长时间运行的分析/渲染工作受益时才使用或启用部署看门狗
- 启动分析或渲染,并在适用时保存返回的进程/会话ID
- 当部署使用看门狗时,让其交付结果
- 终端交付后再次禁用看门狗
4. 后台渲染
bash
单个高光片段
python3 -u scripts/demoslaprender.py ID> ID> --chat-id
集锦视频
python3 -u scripts/demoslaprender.py ID> ... --fragmovie --chat-id ID>
使用exec(background: true)运行并保留返回的进程/会话ID。
OpenClaw环境的可选部署特定看门狗模式:
- - 仅当后台分析/渲染工作需要定期交付检查时才使用看门狗。
- 尽可能重用现有部署看门狗,而不是假设始终需要新的持久调度器条目。
- 如果部署选择通过内置的cron工具创建或启用看门狗,请将其范围限定在活动运行中,并在终端交付后再次禁用它。
- 2分钟间隔是合理的默认值。
- 仅将scripts/demoslapwatchdog.sh status|tail|job用作检查运行时状态、日志或部署特定作业引用的本地辅助工具。
- 在运行时将data/state.json和data/highlights.json视为事实来源。
代理工作流程:
- 1. 仅在活动运行需要时启用或重用部署看门狗
- 启动渲染并保存返回的进程/会话ID
- 轮询进程输出中的Estimated finish:行,如果存在则告知用户预计完成时间
- 当使用看门狗时,让其交付结果
- 终端交付后再次禁用看门狗
关键: 从原始请求的入站元数据中设置。将硬编码的聊天标识符仅视为本地示例,而非可重用的默认值。
5. 检查状态