github gotd/td v0.166.0

latest release: v0.166.1
2 days ago

Adds telegram/user, a bootstrap for user accounts next to telegram/bot, and updates the API docs and error constants from getdoc v0.54.0.

Highlights

telegram/user (#1977)

  • user.Start / user.New connect, sign in only if the stored session isn't authorized, and start the updates and peer managers. Session, update state and access hashes of channels and users live in Options.Dir, so updates sent while stopped are delivered after a restart and known channels need no extra getDifference.
  • Sign in with user.Phone (code + 2FA via auth.NewFlow), user.QR (login token, imported on another DC) or user.AuthFunc. With Auth == nil, Start returns ErrNotAuthorized and sends nothing. A bot session or another account than Options.UserID fails with ErrSessionMismatch.
  • FLOOD_WAIT on sign in is waited out (up to MaxLoginWait) only where it can't send a second code: before the code was requested for Phone, always for QR, never for AuthFunc.
  • New example examples/userbot-echo. telegram/bot now shares the internals (telegram/internal/bootstrap); its API and behaviour are unchanged.
  • Docs: User authentication.

API docs and errors (#1979)

  • getdoc v0.54.0: refreshed doc comments and 42 new error constants (e.g. ErrURLExpired, ErrTopicNotModified, ErrBotCreateLimitExceeded).

Upgrading

Eight error constants that Telegram no longer documents are removed: ErrAnonymousReactionsDisabled, ErrEncryptionDeclineAdminFailed, ErrGroupcallAddParticipantsFailed, ErrNeedDocInvalid, ErrParticipantCallFailed, ErrPasskeyAuthRestart, ErrSavedPeerInvalid, ErrVolumeMoveInvalid. Use the string instead, e.g. tgerr.Is(err, "SAVED_PEER_INVALID").

All changes

  • feat(user): add batteries-included user bootstrap by @ernado in #1977
  • feat: update getdoc to v0.54.0 by @ernado in #1979

Full Changelog: v0.165.1...v0.166.0

Don't miss a new td release

NewReleases is sending notifications on new releases.