MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / pmcaptcha

Function pmcaptcha

pmcaptcha/pmcaptcha.ts:1654–2384  ·  view source on GitHub ↗
(message: Api.Message)

Source from the content-addressed store, hash-verified

1652 wl: `<b>👥 白名单管理</b>
1653
1654<blockquote expandable>• <code>${p}pmc add &lt;ID/@user&gt;</code>
1655 添加白名单(支持回复消息)
1656• <code>${p}pmc del &lt;ID/@user&gt;</code>
1657 移除白名单
1658• <code>${p}pmc wl</code>
1659 查看白名单列表
1660• <code>${p}pmc wl add &lt;ID/@user&gt;</code>
1661 同 add(支持回复消息)
1662• <code>${p}pmc wl del &lt;ID/@user&gt;</code>
1663 同 del
1664• <code>${p}pmc wl del all</code>
1665 清空白名单
1666• <code>${p}pmc wl pass &lt;ID/@user&gt;</code>
1667 手动标记为验证通过并加入白名单</blockquote>`,
1668
1669 record: `<b>📋 验证记录</b>
1670
1671<blockquote expandable>• <code>${p}pmc record</code>
1672 通过/失败人数摘要
1673• <code>${p}pmc record verified</code>
1674 查看验证通过记录
1675• <code>${p}pmc record failed</code>
1676 查看验证失败记录
1677• <code>${p}pmc record del verified &lt;ID&gt;/all</code>
1678 删除通过记录(支持 all)
1679• <code>${p}pmc record del failed &lt;ID&gt;/all</code>
1680 删除失败记录(支持 all)</blockquote>`
1681 };
1682
1683 if (section && sections[section]) return sections[section];
1684 return sections.overview;
1685}
1686
1687// ─── 指令处理器(统一入口)────────────────────────────────────────────────────
1688
1689const pmcaptcha = async (message: Api.Message) => {
1690 if (!getActiveLifecycle()) return;
1691 if (!(await waitDb())) return;
1692 const client = message.client as TelegramClient;
1693 const args = message.message.slice(1).split(/\s+/).slice(1);
1694 const command = (args[0] || "help").toLowerCase();
1695
1696 // ── on / off:启用 / 禁用插件 ────────────────────────────────────────────────
1697 // 注意:off 只停用插件本身,不重置 captcha 状态,下次 on 后自动恢复
1698 if (command === "on" || command === "off") {
1699 const enabling = command === "on";
1700 set(K.ENABLED, enabling);
1701 // ⚠️ 不再自动关闭 captcha_enabled,保留验证配置状态
1702 try {
1703 const tmp = await client.sendMessage(message.peerId, {
1704 message: enabling
1705 ? "✅ <b>PMCaptcha 已启用</b>"
1706 : `🚫 <b>PMCaptcha 已禁用</b>\n验证配置已保留,下次启用后自动恢复`,
1707 parseMode: "html"
1708 });
1709 try { await message.delete(); } catch {}
1710 getActiveLifecycle()?.setTimeout(() => {
1711 void tmp.delete().catch(() => undefined);

Callers

nothing calls this directly

Calls 15

getActiveLifecycleFunction · 0.85
waitDbFunction · 0.85
setFunction · 0.85
logFunction · 0.85
editFunction · 0.85
helpTextFunction · 0.85
getFunction · 0.85
modeLabelFunction · 0.85
refreshActiveCaptchasFunction · 0.85
resolveFailActionFunction · 0.85
resolvePassActionFunction · 0.85
resolveUserFunction · 0.85

Tested by

no test coverage detected