* 把 ManagedGroup 转成可以直接喂给 Api.channels.* 的 channel 参数。 * - channel 有 accessHash → 构造完整 InputChannel,直接走,不触发 GetChannels 兜底 * - channel 无 accessHash(旧缓存或未填)→ 通过 getInputEntity 让 teleproto 自行解析 * - basic group → 返回裸 id(调用方应通过 kind 分流到 messages.* 路径)
( client: TelegramClient, group: ManagedGroup )
| 439 | * 在管理群中按 userId 解析实体;目标不必与命令同群。 |
| 440 | */ |
| 441 | private static async resolveUserAcrossManagedGroups( |
| 442 | client: TelegramClient, |
| 443 | userId: number, |
| 444 | excludePeer?: any, |
| 445 | ): Promise<{ participant?: any; entity?: any }> { |
| 446 | if (!userId) return {}; |
| 447 | let groups: ManagedGroup[] = []; |
| 448 | try { |
| 449 | groups = await GroupManager.getManagedGroups(client); |
| 450 | } catch { |
| 451 | return {}; |
| 452 | } |
| 453 | if (!groups.length) return {}; |
| 454 | |
| 455 | const excludeId = excludePeer |
| 456 | ? Number( |
| 457 | excludePeer?.channelId ?? |
| 458 | excludePeer?.chatId ?? |
| 459 | excludePeer?.userId ?? |
no outgoing calls
no test coverage detected