Changes
- Typed API facade: call any MTProto method as
client.api.messages.sendMessage({...}), with full types for params and results. Method docs from core.telegram.org show up as JSDoc right in the IDE. - Entity cache rewritten: compact records, LRU eviction, optional TTL, bounded by default (4096 peers per segment). Tune with
entityCache: true | false | { max, ttl }, inspect viaclient.entityCache. - Async sessions:
processEntitiesmay return aPromise, so custom sessions can live on Redis or any external store. Storage errors are logged and never fail the request. - Required TL fields are validated before serialization, with a clear error instead of broken payloads.
getButtons()resolves the inline bot through cache, session and network instead of cache only.
Fixes
- A rotated
access_hashnow replaces the stale cached one (#17). - HTML
tg://user?id=…mentions are sent asinputMessageEntityMentionNameand stay clickable; unresolvable ones are kept, not dropped (#19). - Invite links with
+are no longer stripped from sent messages. - A rejected async
session.getInputEntityno longer breaks entity resolution.
Upgrade
- Run:
npm i teleproto@latest - The cache is now bounded by default; pass
entityCache: {}for the old unbounded behavior.