(entity: any)
| 308 | } |
| 309 | |
| 310 | function getEntityDisplayName(entity: any): string | undefined { |
| 311 | if (!entity) return undefined; |
| 312 | if (typeof entity.title === "string" && entity.title.trim()) { |
| 313 | return entity.title.trim(); |
| 314 | } |
| 315 | const names = [entity.firstName, entity.lastName] |
| 316 | .filter((item) => typeof item === "string" && item.trim()) |
| 317 | .join(" "); |
| 318 | if (names.trim()) return names.trim(); |
| 319 | if (typeof entity.username === "string" && entity.username.trim()) { |
| 320 | return `@${entity.username.trim()}`; |
| 321 | } |
| 322 | const idCandidate = |
| 323 | entity.id ?? |
| 324 | entity.peerId ?? |
| 325 | entity.chatId ?? |
| 326 | entity.channelId ?? |
| 327 | entity.userId ?? |
| 328 | entity.peer?.channelId ?? |
| 329 | entity.peer?.userId ?? |
| 330 | entity.peer?.chatId; |
| 331 | if (typeof idCandidate !== "undefined") { |
| 332 | return String(idCandidate); |
| 333 | } |
| 334 | return undefined; |
| 335 | } |
| 336 | |
| 337 | function buildReplyToForMessage( |
| 338 | message: Api.Message |
no outgoing calls
no test coverage detected