(detail: string)
| 290 | if (detail.includes("PEER_ID_INVALID")) { |
| 291 | return "目标对话或用户无效,或当前账号无法访问"; |
| 292 | } |
| 293 | if (detail.includes("USER_ID_INVALID")) { |
| 294 | return "目标用户无效,或不在该对话中"; |
| 295 | } |
| 296 | if (detail.includes("USER_NOT_PARTICIPANT")) { |
| 297 | return "目标用户不在该对话中"; |
| 298 | } |
| 299 | if (detail.includes("ADMINS_TOO_MUCH")) { |
| 300 | return "管理员数量已达到 Telegram 限制"; |
| 301 | } |
| 302 | if (detail.includes("RIGHT_FORBIDDEN")) { |
| 303 | return "当前账号没有足够权限执行该操作"; |
| 304 | } |
| 305 | if (detail.includes("USER_CREATOR")) { |
| 306 | return "群主无法被下掉管理员"; |
| 307 | } |
| 308 | if (detail.includes("BOT_GROUPS_BLOCKED")) { |
| 309 | return "该目标无法被当前方式调整管理员权限"; |
| 310 | } |
| 311 | return detail; |
| 312 | } |
| 313 | |
| 314 | function toTargetChat(entity: Api.Chat | Api.Channel): TargetChat { |
| 315 | return { |
| 316 | entity, |
| 317 | titleDisplay: entity.title || "未命名对话", |
| 318 | username: |
| 319 | entity instanceof Api.Channel && entity.username ? entity.username : null, |
| 320 | isChannel: entity instanceof Api.Channel, |
| 321 | storageKey: String(entity.id), |
| 322 | }; |
| 323 | } |
| 324 | |
| 325 | async function resolveTargetChat( |
| 326 | msg: Api.Message, |
| 327 | rawTarget?: string, |
no outgoing calls
no test coverage detected