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

Function checkGroupsInCommon

pmcaptcha/pmcaptcha.ts:1153–1171  ·  view source on GitHub ↗

* 3. 共同群过白 (groups_in_common) * 用户与自己的共同群 >= N 个时自动通过

(client: TelegramClient, userId: number)

Source from the content-addressed store, hash-verified

1151 const threshold = cfg.groupsInCommon();
1152 if (threshold < 0) return "skip"; // 禁用
1153
1154 try {
1155 const result = await client.invoke(
1156 new Api.users.GetFullUser({ id: userId })
1157 ) as any;
1158 const commonChatsCount = result?.fullUser?.commonChatsCount ?? 0;
1159 if (commonChatsCount >= threshold) {
1160 wl.add(userId);
1161 log(LogLevel.INFO, `Auto-pass user ${userId} by groups_in_common (${commonChatsCount} >= ${threshold})`);
1162 return "pass";
1163 }
1164 } catch (e) {
1165 log(LogLevel.WARN, `checkGroupsInCommon failed for ${userId}`, e);
1166 }
1167 return "skip";
1168}
1169
1170/**
1171 * 4. 关键词过白 (word_filter)
1172 * 消息包含白名单关键词 → 自动通过
1173 * 消息包含黑名单关键词 → 自动拦截
1174 */

Callers 1

runAutoRulesFunction · 0.85

Calls 2

logFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected