(msg: Api.Message, args: string[])
| 313 | try { |
| 314 | const e = entityFields(await cl.getEntity(raw)); |
| 315 | targetId = String(e.id); |
| 316 | const plain = htmlEsc([e.firstName, e.lastName].filter(Boolean).join(' ') || e.title || targetId); |
| 317 | name = e.username ? `<a href="https://t.me/${e.username}">${plain}</a>` : plain; |
| 318 | } catch { |
| 319 | name = raw; |
| 320 | targetId = raw.replace(/^@/, ""); |
| 321 | } |
| 322 | } else if (msg.isReply) { |
| 323 | const r = await safeGetReplyMessage(msg); |
| 324 | if (r?.senderId) { |
| 325 | targetId = String(r.senderId); |
| 326 | try { |
| 327 | const u = entityFields(await cl.getEntity(r.senderId)); |
| 328 | const plain = htmlEsc([u.firstName, u.lastName].filter(Boolean).join(' ') || targetId); |
| 329 | name = u.username ? `<a href="https://t.me/${u.username}">${plain}</a>` : plain; |
| 330 | } catch { |
| 331 | name = targetId; |
| 332 | } |
| 333 | } |
| 334 | } |
| 335 | return targetId ? { id: targetId, name } : null; |
| 336 | } |
no test coverage detected