QuotLy Style Sticker
How To Call (Agent)
- 1. Build payload with required
selected_messages. - When available, include event metadata for dedupe:
-
context.event.channel (example:
telegram)
-
context.event.update_id (preferred)
- fallback keys:
event_id,
delivery_id,
id
- 3. Run:
-
python3 scripts/openclaw_quote_autoreply.py --input <json-file-or->
- 4. Use tool-emitted
MEDIA: for delivery. - Final assistant text must be empty.
Input
- - Required:
selected_messages (array, must not be empty) - Optional:
context.event for dedupe accuracy
-
channel (string)
-
update_id (string or number, preferred)
-
event_id /
delivery_id /
id (fallback keys)
{
"message": {
"message_id": 2002,
"text": "Forwarded message content",
"forward_from": {
"type": "hidden_user", // optional, indicates hidden user
"id": 123456789, // optional, user id
"first_name": "张", // required, first name or nickname
"last_name": "三", // optional, last name
"avatar_url": "", // optional, avatar url or base64 data (from user profile or platform API)
"status_url": "" // optional, status url or base64 data (from user profile or platform API)
}
},
// Optional: override message fields
"overwrite_message": {
"text": "哈哈哈哈哈",
"forward_from": {
"avatar_url": "", // from user profile or platform API
"status_url": "" // from user profile or platform API
},
"entities": [ // optional, text formatting entities
{"type": "bold", "offset": 0, "length": 4},
{"type": "italic", "offset": 5, "length": 4}
]
}
}
- - Optional canvas:
width, height, scale, max_width, border_radius, picture_radius, INLINECODE22
Entities (Text Formatting)
The skill supports Telegram-style message entities for text formatting:
CODEBLOCK1
Supported types: mention, hashtag, cashtag, bot_command, url, email, phone_number, bold, italic, underline, strikethrough, spoiler, code, pre, text_link, text_mention, INLINECODE39
Entity fields:
- -
type (required) - entity type - INLINECODE41 (required) - UTF-8 offset in text
- INLINECODE42 (required) - UTF-8 length
- INLINECODE43 (optional) - for
text_link type - INLINECODE45 (optional) - for
text_mention type - INLINECODE47 (optional) - for
pre type - INLINECODE49 (optional) - for
custom_emoji type
Field Mapping
-
overwrite_message.text >
message.text
-
overwrite_message.forward_from >
message.forward_from
- - Text formatting (entities):
-
overwrite_message.entities >
message.entities > INLINECODE57
Output
-
Quote sticker generated.
-
MEDIA:<absolute-path-to-webp>
- - For duplicate retries detected within dedupe window, generation is skipped and no
MEDIA: line is emitted.
Environment Variables
- -
QUOTLY_API_URL - QuotLy API endpoint (default: https://bot.lyo.su/quote/generate). - INLINECODE63 - Comma-separated list of allowed API hosts (e.g.,
bot.lyo.su). When set, the skill will only contact hosts in this list. - INLINECODE65 - Set to
1, true, or yes to enable audit logging to stderr. - INLINECODE69 - Suppress duplicate requests for the same event/payload within this window (default:
180). Set to 0 to disable.
Dedupe Key (How _build_dedupe_key reads input)
INLINECODE73 resolves keys in this order:
- 1.
context.event.update_id (or event_id / delivery_id / id) - INLINECODE78 (or
event_id / delivery_id / id) when context.event is missing - INLINECODE83 (nested update object)
- Fallback: stable hash of INLINECODE84
Recommended wrapper payload:
CODEBLOCK2
Security Notes
- - This skill sends message content to an external API to generate stickers.
- SSRF Protection: Multiple layers of protection are implemented:
- Hostname validation blocks internal/private IPs, localhost, and metadata endpoints
- DNS rebinding protection: resolves hostnames and validates resolved IPs
- Path traversal prevention: blocks
.. and suspicious path patterns
- URL credentials stripping: removes username/password from URLs
- - Request Limits: Maximum payload size 1MB, maximum response size 10MB
- Audit Logging: Enable with
QUOTLY_AUDIT_LOG=1 to log API requests and responses for security monitoring - In sensitive environments, always set
QUOTLY_API_ALLOW_HOSTS to restrict which hosts the skill can contact. - Avatar and status URLs from user input are passed to the rendering service; ensure input comes from trusted sources.
Reply Rule
- - Do not output any final text.
QuotLy风格贴纸
调用方式(代理)
- 1. 使用必需的selected_messages构建负载。
- 如果可用,包含事件元数据以进行去重:
- context.event.channel(示例:telegram)
- context.event.update_id(首选)
- 备用键:event
id、deliveryid、id
- 3. 运行:
- python3 scripts/openclaw
quoteautoreply.py --input
- 4. 使用工具发出的MEDIA:进行投递。
- 最终助手文本必须为空。
输入
- - 必需:selected_messages(数组,不能为空)
- 可选:用于去重精度的context.event
- channel(字符串)
- update_id(字符串或数字,首选)
- eventid / deliveryid / id(备用键)
json5
{
message: {
message_id: 2002,
text: 转发的消息内容,
forward_from: {
type: hidden_user, // 可选,表示隐藏用户
id: 123456789, // 可选,用户ID
first_name: 张, // 必需,名字或昵称
last_name: 三, // 可选,姓氏
avatar_url: , // 可选,头像URL或base64数据(来自用户资料或平台API)
status_url: // 可选,状态URL或base64数据(来自用户资料或平台API)
}
},
// 可选:覆盖消息字段
overwrite_message: {
text: 哈哈哈哈哈,
forward_from: {
avatar_url: , // 来自用户资料或平台API
status_url: // 来自用户资料或平台API
},
entities: [ // 可选,文本格式实体
{type: bold, offset: 0, length: 4},
{type: italic, offset: 5, length: 4}
]
}
}
- - 可选画布:width、height、scale、maxwidth、borderradius、pictureradius、backgroundcolor
实体(文本格式)
该技能支持Telegram风格的消息实体进行文本格式化:
json5
[
{type: bold, offset: 0, length: 5},
{type: italic, offset: 6, length: 6},
{type: url, offset: 13, length: 15, url: https://example.com}
]
支持的类型: mention、hashtag、cashtag、botcommand、url、email、phonenumber、bold、italic、underline、strikethrough、spoiler、code、pre、textlink、textmention、custom_emoji
实体字段:
- - type(必需)- 实体类型
- offset(必需)- 文本中的UTF-8偏移量
- length(必需)- UTF-8长度
- url(可选)- 用于textlink类型
- user(可选)- 用于textmention类型
- language(可选)- 用于pre类型
- customemojiid(可选)- 用于custom_emoji类型
字段映射
- overwrite_message.text > message.text
- overwritemessage.forwardfrom > message.forward_from
- overwritemessage.entities > message.entities > message.captionentities
输出
- Quote sticker generated.
- MEDIA:
- - 如果在去重窗口内检测到重复重试,则跳过生成且不输出MEDIA:行。
环境变量
- - QUOTLYAPIURL - QuotLy API端点(默认:https://bot.lyo.su/quote/generate)。
- QUOTLYAPIALLOWHOSTS - 允许的API主机列表,以逗号分隔(例如:bot.lyo.su)。设置后,技能将仅联系此列表中的主机。
- QUOTLYAUDITLOG - 设置为1、true或yes以启用审计日志记录到标准错误输出。
- QUOTLYDEDUPWINDOWSECONDS - 在此窗口内抑制相同事件/负载的重复请求(默认:180)。设置为0以禁用。
去重键(builddedupe_key如何读取输入)
builddedupekey(inputpayload)按以下顺序解析键:
- 1. context.event.updateid(或eventid / deliveryid / id)
- 当缺少context.event时,使用event.updateid(或eventid / deliveryid / id)
- context.event.update.updateid(嵌套的更新对象)
- 备用:selectedmessages的稳定哈希
推荐的包装负载:
json
{
context: {
event: {
channel: telegram,
update_id: 123456789
}
},
selected_messages: [
{
message: {
message_id: 2002,
text: 转发的消息内容
}
}
]
}
安全说明
- - 此技能将消息内容发送到外部API以生成贴纸。
- SSRF保护:实现了多层保护:
- 主机名验证阻止内部/私有IP、本地主机和元数据端点
- DNS重绑定保护:解析主机名并验证解析后的IP
- 路径遍历防护:阻止..和可疑路径模式
- URL凭据剥离:从URL中移除用户名/密码
- - 请求限制:最大负载大小1MB,最大响应大小10MB
- 审计日志:使用QUOTLYAUDITLOG=1启用,以记录API请求和响应用于安全监控
- 在敏感环境中,始终设置QUOTLYAPIALLOW_HOSTS以限制技能可以联系的主机。
- 用户输入的头像和状态URL会传递给渲染服务;确保输入来自可信来源。
回复规则