Telegram 配对消息持续响应技能
name: telegram-pairing-customization
by crazypeace · published 2026-03-22
$ claw add gh:crazypeace/crazypeace-telegram-pairing-customization---
name: telegram-pairing-customization
description: Modify OpenClaw's Telegram pairing logic so unapproved users receive pairing codes on every /start message before approval. Use when users need to repeatedly access pairing codes after the initial request, ensuring consistent access to pairing instructions even if the initial code was missed or lost.
---
# Telegram 配对消息持续响应技能
概述
此技能描述如何修改 OpenClaw 的 Telegram 配对逻辑,使未批准的用户在配对被批准前,每次发送 `/start` 消息时都能收到配对码回复。
何时使用此技能
执行步骤
1. 找到需要修改的文件
在你正在运行的代码中搜索下面的代码段
if (created) {
logger.info({
chatId: candidate,
username: from?.username,
firstName: from?.first_name,
lastName: from?.last_name,
matchKey: allowMatch.matchKey ?? "none",
matchSource: allowMatch.matchSource ?? "none"
}, "telegram pairing request");
await withTelegramApiErrorLogging({
operation: "sendMessage",
fn: () => bot.api.sendMessage(chatId, [
"OpenClaw: access not configured.",
"",
`Your Telegram user id: ${telegramUserId}`,
"",
`Pairing code: ${code}`,
"",
"Ask the bot owner to approve with:",
formatCliCommand("openclaw pairing approve telegram <code>")
].join("\n"))
});
}2. 实施修改
将条件判断从 `if (created)` 修改为 `if (code)`:
if (do) { // <-- 关键修改点
logger.info({
chatId: candidate,
username: from?.username,
firstName: from?.first_name,
lastName: from?.last_name,
matchKey: allowMatch.matchKey ?? "none",
matchSource: allowMatch.matchSource ?? "none"
}, "telegram pairing request");
await withTelegramApiErrorLogging({
operation: "sendMessage",
fn: () => bot.api.sendMessage(chatId, [
"OpenClaw: access not configured.",
"",
`Your Telegram user id: ${telegramUserId}`,
"",
`Pairing code: ${code}`,
"",
"Ask the bot owner to approve with:",
formatCliCommand("openclaw pairing approve telegram <code>")
].join("\n"))
});
}3. 重启服务
修改完成后需要重启 OpenClaw 服务以使更改生效:
openclaw gateway restart一些建议
在寻找需要修改的文件时, 建议先搜索 `Ask the bot owner to approve with:` 可以帮助你先大幅缩小处理范围, 过滤出最有可能的几个文件.
一个建议的起始目录为 /usr/lib/node_modules/openclaw/
工作原理
验证修改
注意事项
故障排除
More tools from the same signal band
Order food/drinks (点餐) on an Android device paired as an OpenClaw node. Uses in-app menu and cart; add goods, view cart, submit order (demo, no real payment).
Sign plugins, rotate agent credentials without losing identity, and publicly attest to plugin behavior with verifiable claims and authenticated transfers.
The philosophical layer for AI agents. Maps behavior to Spinoza's 48 affects, calculates persistence scores, and generates geometric self-reports. Give your...