( client: any, raw: string, )
| 139 | if (/^-?\d+$/.test(raw)) { |
| 140 | const numeric = Number(raw); |
| 141 | if (Number.isSafeInteger(numeric)) attempts.push(numeric); |
| 142 | } |
| 143 | |
| 144 | let lastError: unknown; |
| 145 | for (const attempt of attempts) { |
| 146 | try { |
| 147 | return await client.getEntity(attempt); |
| 148 | } catch (error) { |
| 149 | lastError = error; |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | throw lastError ?? new Error(`无法解析 ${raw}`); |
| 154 | } |
| 155 | |
| 156 | async function resolveChatTarget( |
| 157 | client: any, |
| 158 | raw: string, |
| 159 | label: string, |
| 160 | ): Promise<ResolvedChat> { |
| 161 | try { |
| 162 | const entity = await resolveEntityWithFallback(client, raw); |
| 163 | return { |
| 164 | raw, |
no outgoing calls
no test coverage detected