(
client: TelegramClient,
chatId: any
)
| 499 | new Api.messages.GetFullChat({ |
| 500 | chatId: bigInt(Math.abs(Number(group.id))), |
| 501 | }) |
| 502 | ); |
| 503 | const matched = (full?.users || []).find((u: any) => Number(u?.id) === userId); |
| 504 | if (matched && !found.participant) { |
| 505 | const input = await this.safeGetInputEntity(client, matched); |
| 506 | if (input) found = { participant: input, entity: matched }; |
| 507 | } |
| 508 | } catch { |
| 509 | // skip |
| 510 | } |
| 511 | }), |
| 512 | ), |
| 513 | ); |
| 514 | |
| 515 | return found; |
| 516 | } |
| 517 | |
| 518 | static formatUser(user: any, userId: number): string { |
| 519 | if (user?.firstName || user?.first_name) { |
| 520 | let name = user.firstName || user.first_name || String(userId); |
| 521 | if (user.lastName || user.last_name) { |
| 522 | name += ` ${user.lastName || user.last_name}`; |
| 523 | } |
| 524 | if (user.username) { |
| 525 | name += ` (@${user.username})`; |
| 526 | } |
| 527 | return name; |
| 528 | } else if (user?.title) { |
| 529 | return `频道: ${user.title}${user.username ? ` (@${user.username})` : ''}`; |
| 530 | } |
| 531 | return String(userId); |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | // ==================== 消息管理器 ==================== |
| 536 | class MessageManager { |
| 537 | static async smartEdit( |
| 538 | message: Api.Message, |
no test coverage detected